The Query Builder is a great tool that allows us to search for nodes in the JCR. We often as AEM developers use this tool to build a query for us to use in the backend to build query descriptions (predicates); the set of predicates produced will call the Predicate Evaluator which knows how to handle that specific predicate for XPath, filtering, and facet extraction.
In this article, we will be sharing query examples to find all AEM pages with single-tag && multi-tags using the Query Builder Debugger tool.
1. Find all AEM pages with a single cq:tag
Find all pages under /content/we-retail,
and has the tag of we-retail:apparel/pants,
show max results.
1 2 3 4 5 | path=/content/we-retail type=cq:Page property=jcr:content/@cq:tags property.value=we-retail:apparel/pants p.limit=-1 |
1. Find all AEM pages with multiple cq:tags
Find all pages under /content/we-retail, a
and
((has the tag of we-retail:apparel/pants) or
(has the tag of we-retail:apparel/pants)),
show max results.
1 2 3 4 5 6 7 8 | path=/content/we-retail type=cq:Page group.1_property=jcr:content/@cq:tags group.1_property.value=we-retail:apparel/pants group.2_property=jcr:content/@cq:tags group.2_property.value=we-retail:apparel/shirt group.p.or=true p.limit=-1 |