Expand my Community achievements bar.

AEM6.3 QueryBuilder- Using groups of predicates when at least one group must satisfy all conditions

Avatar

Level 3

Hi,

I am using Query Builder to develop a search in a website. I was looking some tutorials and I cannot find many tutorials with complex queries.

I want to group my instructions with an AND predicate, and on my case I will have three groups, that has an OR predicate between then.

In resume, all the instructions of group A must satify OR all the results of group B must satisfy OR all the results of group C must satisfy

For example:

(GroupA.condition &&  GroupA.condition2 && GroupA.condition3) OR (GroupB.condition &&  GroupB.condition2 && GroupB.condition3) OR (GroupC.condition &&  GroupC.condition2 && GroupC.condition3)

PS: I am developing using Query Builder Debugger Tool

I appreciate any help

Thank you very much!

1 Reply

Avatar

Community Advisor
  • group: This predicate is used to create logical conditions in your query. You can create complex conditions using OR & AND operators in different groups.  e.g:

  Example

type=nt:base

path:/content/AEM63App/en

group.1_property=jcr:created

group.1_property.value= admin

group.1_property=jcr:title

group.1_property.value=Travel

group.1_property.and=true

group.2_property=jcr:primaryType

group.2_property.value=cq:PageContent

group.p.or=true

  

  this query will return result if (jcr:created==admin AND jcr:title ==Travel ) OR (jcr:primaryType == cq:PageContent)

hope this will help.

Thanks

Arun



Arun Patidar