QUery with operation like and equalsignorecase | Community
Skip to main content
Keerthi0555
Level 5
September 3, 2024
Solved

QUery with operation like and equalsignorecase

  • September 3, 2024
  • 3 replies
  • 728 views

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.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by h_kataria

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

 

3 replies

arunpatidar
Community Advisor
Community Advisor
September 3, 2024

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/core/predicate/sample/CaseInsensitiveLikePredicate.java 

 

Arun Patidar
h_kataria
Community Advisor
h_katariaCommunity AdvisorAccepted solution
Community Advisor
September 4, 2024

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