Search code examples
aemquery-builder

Search for pages tagged with a tag title


In order to get pages tagged with a certain tag in AEM query builder, we will do as this doc (https://helpx.adobe.com/experience-manager/6-2/sites/developing/using/querybuilder-api.html)

    path=/content/...
    type=cq:Page
    tagid=marketing:interest/product
    tagid.property=jcr:content/cq:tags

But how do we get pages that have the same tag title without using the whole tag's ID or full path above ? For example

    path=/content/...
    type=cq:Page
    tagtitle=product
    tagid.property=jcr:content/cq:tags

Solution

  • You could use something like that:

    JCR like:

    path=/content/..
    type=cq:Page
    property=jcr:content/@cq:tags
    property.value=%tagname
    property.operation=like
    

    This would search for cq:tags property with value that ends with "product". See more about jcr:like function.

    Another possible solution:

    Full text search:

    path=/content/somesite
    type=cq:Page
    fulltext.relPath=jcr:content/@cq:tags
    fulltext=tagname
    

    See more about jcr:contains function