Harish Menda
Harish Menda

Reputation: 71

AEM CQ5 Query Builder: How to get result by searching for 2 different values in same property?

I want to get result matches with all nodes contains property 'abc' value as 'xyz' or 'pqr'.

I am trying in below ways:

  1. http://localhost:4502/bin/querybuilder.json?path=/content/campaigns/asd&property=abc&property.1_value=/%xyz/%&property.2_value=/%pqr/%property.operation=like&p.limit=-1&orderby:path

  2. http://localhost:4502/bin/querybuilder.json?path=/content/campaigns/asd&property=abc&property.1_value=/%xyz/%&property.2_value=/%pqr/%&property.1_operation=like&property.2_operation=like&p.limit=-1&orderby:path

  3. http://localhost:4502/bin/querybuilder.json?path=/content/campaigns/asd&1_property=abc&1_property.1_value=/%xyz/%&1_property.1_operation=like&2_property=abc&1_property.1_value=/%xyz/%&2_property.1_operation=like&p.limit=-1&orderby:path

But none of them served my purpose. Any thing that I am missing in this?

Upvotes: 1

Views: 2381

Answers (3)

Harish Menda
Harish Menda

Reputation: 71

It worked with below query:

http://localhost:4502/bin/querybuilder.json?orderby=path
&p.limit=-1
&path=/content/campaigns
&property=jcr:content/par/nodeName/xyz
&property.1_value=pqr
&property.2_value=%abc%
&property.operation=like
&type=cq:Page

Note: property name should be fully specified form the type of node we are expecting.

Ex: jcr:content/par/nodeName/xyz above instead of just xyz

Upvotes: 0

user1057653
user1057653

Reputation: 176

You can actually use the 'OR' operator in your query to combine two or more values of a property. For example in the query debug interface : http:///libs/cq/search/content/querydebug.html

path=/content/campaigns/asd
property=PROPERTY1
property.1_value=VALUE1
property.2_value=VALUE2
property.operation=OR
p.limit=-1

Upvotes: 0

rakhi4110
rakhi4110

Reputation: 9281

The query looks right and as such should work. However if it is just xyz or pqr you would like to match in the query, you may not need the / in the values.

For eg.

path=/content/campaigns/asd
path.self=true //In order to include the current path as well for searching
property=abc
property.1_value=%xyz%
property.2_value=%abc%
property.operation=like
p.limit=-1

Possible things which you can check

  1. Check if the path that you are trying to search contains the desired nodes/properties.
  2. Check if the property name that you are using is right.
  3. If you want to match exact values, you can avoid using the like operator and remove the wild cards from the values.

Upvotes: 2

Related Questions