Expand my Community achievements bar.

SOLVED

Make a not like (or unlike) request using predicate

Avatar

Former Community Member

Hi,

I'm trying to make a request with predicates in which I can look for a property that doesn't contains a value.

I use the Querybuilder debugger and figure out that this predicates :

type=dam:Asset
path=/content

property:jcr:content/metadata/keywords
property.value:keyword:mykeyword
property.operation:like

will end to this XPATH request :

/jcr:root/content//element(*, dam:Asset)
[
jcr:like(jcr:content/metadata/@keywords, 'keyword:mykeyword')
]

 

This is good but what i want now is build a predicate that will end on this request: 

/jcr:root/content//element(*, dam:Asset)
[
not(jcr:like(jcr:content/metadata/@keywords, 'keyword:mykeyword'))
]

 

And for the moment, a can't figure out a solution because unlike does exist for the predicates and the "not" operation look for asset that doesn't have my value.

 

Thanks for help !

1 Accepted Solution

Avatar

Correct answer by
Level 10

You can create a custom predicate that extends com.day.cq.commons.predicate.AbstractNodePredicatewithin a Sling Servlet that assits in searching JCR data. See  http://helpx.adobe.com/experience-manager/using/creating-custom-cq-tree.html

View solution in original post

2 Replies

Avatar

Correct answer by
Level 10

You can create a custom predicate that extends com.day.cq.commons.predicate.AbstractNodePredicatewithin a Sling Servlet that assits in searching JCR data. See  http://helpx.adobe.com/experience-manager/using/creating-custom-cq-tree.html

Avatar

Employee

I would also suggest filing a feature request for this via DayCare.