QueryBuilder case insensitive like operation AEM 6.4 | Community
Skip to main content
Mar 27, 2019 6:28 AM UTC
Solved

QueryBuilder case insensitive like operation AEM 6.4

I have  a JCR-SQL2 Query . And is being used by QueryManager to perform case insensitive search using lower() method. I want to do the same using QueryBuilder API. We are using aem 6.4 . and  fn:lower-case(jcr:content/jcr:title)   doesn't work.

SELECT * FROM[cq:Page]  WHERE ISDESCENDANTNODE(path) AND

( lower([jcr:content/jcr:title]) LIKE '%vehi%' OR lower([jcr:content/jcr:title]) LIKE '%auto%' )

UNION

SELECT * FROM[cq:Page]  WHERE ISDESCENDANTNODE(path) AND

( lower([jcr:content/jcr:description]) LIKE '%vehi%' OR lower([jcr:content/jcr:description]) LIKE '%auto%' )

UNION

SELECT * FROM[cq:Page]  WHERE ISDESCENDANTNODE(path) AND

( lower([jcr:content/cq:tags]) LIKE '%vehi%' OR lower([jcr:content/cq:tags]) LIKE '%auto%' )

ORDER BY [jcr:content/cq:lastModified] desc

Any inputs are helpful

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Kunal_Gaba_
Kunal_Gaba_Accepted solution
New Participant
Apr 1, 2019 9:21 AM UTC

The query builder does not support functions now and this solution stopped working after AEM 6.2. You need to write a custom predicate for this. Check this example - Experiencing Adobe Experience Manager - Day CQ: AEM 6 SP2 - Query Builder Predicate Evaluator for ordering results Ignor…

5 replies

smacdonald2008
Level 10
Apr 1, 2019 4:00 PM UTC

Very nice community response!

Translate
Kunal_Gaba_
Kunal_Gaba_Accepted solution
New Participant
Apr 1, 2019 9:21 AM UTC

The query builder does not support functions now and this solution stopped working after AEM 6.2. You need to write a custom predicate for this. Check this example - Experiencing Adobe Experience Manager - Day CQ: AEM 6 SP2 - Query Builder Predicate Evaluator for ordering results Ignor…

Translate
Apr 1, 2019 8:57 AM UTC

Created 2 queries , one with the method suggested and one without it.

In case of using fn-lowercase, even the XPath query is not translated. However without using method query returns result.

We are using AEM 6.4.

Translate
smacdonald2008
Level 10
Mar 27, 2019 3:49 PM UTC
Gaurav-Behl
Level 10
Mar 27, 2019 2:06 PM UTC

check AEM 6.2  "fn:lowercase"  is not working

As Justin mentioned here, querybuilder search on Property case insensitive , QB would not be appropriate in this case

Translate