Since CQ5.6.0 there is a change when you per­form a search around tags. The change is that before a search was done that exactly matched the tag, cur­rently *also* con­tent is found that con­tains a sub-tag.

I will show you the dif­fer­ence in this blogpost.

I am going to exe­cute the fol­low­ing search in a CQ5.5 and CQ5.6 environment:

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

This will find pages that con­tain the tag ‘marketing:interest’, this is one of the default tags of the Geometrixx application.

For exam­ple here you see the page-properties of the fol­low­ing page “/content/geometrixx/en/products/square.html”

I also enabled the debug log-level for the com.day.cq.search pack­age. This way we can see the xpath that gets exe­cuted in the end in the JCR-repository.

Search results

Here the results if you exe­cute the search statement:

CQ5.5

{“success”:true,“results”:0,“total”:0,“offset”:0,“hits”:[]}

CQ5.6

{“success”:true,“results”:10,“total”:24,“offset”:0,“hits”:[.……]}

As you can see we have no results in CQ5.5, and 24 hits in CQ5.6.

The rea­son for that is that with CQ5.6 if a page con­tains a sub-tag of the tag that you search, the page will be found.

Xpath state­ments

Because I have enabled debug­ging I can see the inter­nal Xpath state­ment that is executed.

Here you see the two statements:

CQ5.5

//element(*, cq:Page)[jcr:content/@cq:tags = ‘marketing:interest’]

CQ5.6

//element(*, cq:Page)[jcr:content/@cq:tags = ‘marketing:interest’ or jcr:content/@cq:tags = ‘/etc/tags/marketing/interest’ or jcr:like(jcr:content/@cq:tags, ‘marketing:interest/%’) or jcr:like(jcr:content/@cq:tags, ‘/etc/tags/marketing/interest/%’)]

 

So when you do an upgrade to CQ5.6 then take this change into account.

@heervisscher