Reputation: 1242
I'm using query builder to search for images in DAM. I use predicates to do that. I'm trying to check metadata dam:MIMEtype property, to return all nodes which starts from image/.
How can I do that?
Upvotes: 5
Views: 15389
Reputation: 9281
You can use the JcrPropertyPredicateEvaluator to achieve the same.
Assuming that you are searching the path /content/dam
for all dam:Asset
's whose dam:MIMEtype
starts with image/
the query would be
path=/content/dam
type=dam:Asset
property=jcr:content/metadata/dam:MIMEtype
property.value=image/%
property.operation=like
p.limit=-1
The corresponding XPATH query would be
/jcr:root/content/dam//element(*, dam:Asset)
[
jcr:like(jcr:content/metadata/@dam:MIMEtype, 'image/%')
]
You can try executing the above query in your instance's query debugger(/libs/cq/search/content/querydebug.html
) and verify if the results are fine.
PredicateEvaluator Docs and the QueryBuilder API might provide more insights on writing queries.
Upvotes: 12