How to use the OR operator in querybuilder? | Community
Skip to main content
jayv25585659
Level 8
April 19, 2023
Solved

How to use the OR operator in querybuilder?

  • April 19, 2023
  • 1 reply
  • 2572 views

I've searched around and found lots of tutorials on this subject. Supposedly, if I don't specify the logical operator, AEM will use "OR".

 

BUT that's not the case in my recent experience.

 

I tried the 2 queries below. In both instances, the xpath generated uses "AND". Can you please help? Thanks

 

1st query path=/content type=cq:Page 1_daterange.property=jcr:content/cq:lastModified 1_daterange.lowerBound=2023-01-01T00:00:00 2_daterange.property=jcr:created 2_daterange.lowerBound=2023-01-01T00:00:00 p.limit=-1 ----------------- 2nd query path=/content type=cq:Page 1_daterange.property=jcr:content/cq:lastModified 1_daterange.lowerBound=2023-01-01T00:00:00 2_daterange.property=jcr:created 2_daterange.lowerBound=2023-01-01T00:00:00 p.and=false p.limit=-1 ----------------------- generated xpath /jcr:root/content//element(*, cq:Page) [ ((jcr:content/@cq:lastModified > xs:dateTime('2023-01-01T00:00:00.000+11:00') ) and (@jcr:created > xs:dateTime('2023-01-01T00:00:00.000+11:00') )) ]

 

Best answer by Siva_Sogalapalli

@jayv25585659 Please try below query:

 

path=/content
type=cq:Page
group.1_daterange.property=jcr:content/cq:lastModified
group.1_daterange.lowerBound=2023-01-01T00:00:00
group.2_daterange.property=jcr:created
group.2_daterange.lowerBound=2023-01-01T00:00:00
group.p.or=true
p.limit=-1

1 reply

Siva_Sogalapalli
Community Advisor
Siva_SogalapalliCommunity AdvisorAccepted solution
Community Advisor
April 19, 2023

@jayv25585659 Please try below query:

 

path=/content
type=cq:Page
group.1_daterange.property=jcr:content/cq:lastModified
group.1_daterange.lowerBound=2023-01-01T00:00:00
group.2_daterange.property=jcr:created
group.2_daterange.lowerBound=2023-01-01T00:00:00
group.p.or=true
p.limit=-1

jayv25585659
Level 8
April 19, 2023

works! Thanks!