Expand my Community achievements bar.

SOLVED

QUery with operation like and equalsignorecase

Avatar

Level 6

Hi Team,

I need to execute a query which has to support both like operation and equalsignorecase

path=/content/
type=cq:Page
property=jcr:content/jcr:title
property.value=%Construction%
property.operation=like

But I'm able to use only like operation and equalsIgnorecase separately i need both like and equlsignorecase in the same query.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @Keerthi0555 
You can do that using an Xpath query like this

/jcr:root/content/abc//element(*, cq:Page)
[
(jcr:like(fn:lower-case(jcr:content/@jcr:title), '%Construction%'))
]

 

View solution in original post

3 Replies

Avatar

Community Advisor

Hi @Keerthi0555 
QueryBuilder does not support equal ignore case, better to create custom predicate

However the query with equal and like can be constructed like below:

path=/content/aemlab
type=cq:Page
group.1_property=jcr:content/jcr:title
group.1_property.value=%Construction%
group.1_property.operation=like
group.2_property=jcr:content/jcr:title
group.2_property.value=%Construction%
group.2_property.operation=equals
group.p.or=true

Custom Predicate Example : https://github.com/arunpatidar02/aemaacs-aemlab/blob/master/core/src/main/java/com/community/aemlab/... 

 



Arun Patidar

Avatar

Correct answer by
Community Advisor

Hi @Keerthi0555 
You can do that using an Xpath query like this

/jcr:root/content/abc//element(*, cq:Page)
[
(jcr:like(fn:lower-case(jcr:content/@jcr:title), '%Construction%'))
]