Expand my Community achievements bar.

SOLVED

QueryBuilder case insensitive like operation AEM 6.4

Avatar

Level 1

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

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

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 or...

View solution in original post

5 Replies

Avatar

Level 1

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.

1722931_pastedImage_1.png

1722930_pastedImage_0.png

Avatar

Correct answer by
Employee Advisor

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 or...