Expand my Community achievements bar.

SOLVED

How to use the OR operator in querybuilder?

Avatar

Level 9

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') ))
]

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

@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

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

@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