Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events
SOLVED

Query Builder AEM 6.5: does not contain predicate

Avatar

Level 5

Hi everyone, so when I need to add a query for contains I use like operation as shown below:

 

```

type=nt:unstructured
path=/content/dam/en/articles
nodename=master
orderby=@title
p.limit=0
p.skip=0
p.hits=selective
p.properties=jcr:path
property=primaryCategoryTag
property.value=%rally%
property.operation=like

```

 

However I have a use case where I need to do contains not, can someone help me to do the same? Is there any operation as `unlike`? Which helps me pick all those entities which doesn't contain the given text?

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

I think this is not possible with QueryBuilder , you can create your own predicate e.g.

https://github.com/arunpatidar02/aem63app-repo/blob/master/java/CaseInsensitiveLikePredicate.java 

 

or use SQL2



Arun Patidar

View solution in original post

5 Replies

Avatar

Correct answer by
Community Advisor

I think this is not possible with QueryBuilder , you can create your own predicate e.g.

https://github.com/arunpatidar02/aem63app-repo/blob/master/java/CaseInsensitiveLikePredicate.java 

 

or use SQL2



Arun Patidar

Avatar

Level 5

If lets say I want to deploy these to AEM cloud locally, where am I supposed to add these files? Predicates that I create?

Avatar

Community Advisor

This is a java code, you have to deploy via code module.



Arun Patidar

Avatar

Level 5

Also the predicate that you have created, I was wondering if I can use it with groups? Like for example:

 

1_group.1_caseinsensitive.property=jcr:content/@jcr:title

1_group.1_caseinsensitive.value=queryString %

 

Will this work with your example? And if yes, can you please tell me where and how can I add this predicate in order to test it in my local AEM instance?

Avatar

Community Advisor

It is just an example, you have to write your own logic.



Arun Patidar