1
votes

AEM allows me to query against a REST API like so:

Search for pages tagged with a certain tag

http://localhost:4502/bin/querybuilder.json?type=cq:Page&tagid=marketing:interest/product&tagid.property=jcr:content/cq:tags

1 type=cq:Page
2 tagid=marketing:interest/product
3 tagid.property=jcr:content/cq:tags

However what if I want all pages that don't include a certain tag?

 1 type=cq:Page
 2 tagid=marketing:interest/product
 3 tagid.property=jcr:content/cq:tags

In xPath I can do something like:

//jcr:content/cq:tags[not(@tagId = 'marketing:interest/product')]

Is this possible through the REST API?

2

2 Answers

2
votes

Here you go:

path=/content/some/path/you/need
type=cq:Page
group.1_fulltext=marketing:interest/product
group.1_fulltext.relPath=jcr:content/@cq:tags
group.p.not=true

what correpsonds to next xpath query:

/jcr:root/content/some/path/you/need//element(*, cq:Page) [ not(jcr:contains (jcr:content/@cq:tags, 'marketing:interest/product')c) ].

Also you can add p.limit=[some number] to get more than 10 results.

Some interesting info you can find there and more about available predicates (check implementing classes).

0
votes

I tried /jcr:root/content/geometrixx//element(*, cq:Page)[(jcr:content/@cq:template != '/apps/geometrixx/templates/contentpage') ]

It gives me pages under /content/geometrixx which do not use template path /apps/geometrixx/templates/contentpage