Jul 04, 2013

Change in Tag-search since CQ5.6

Posted by Feike Visser

Since CQ5.6.0 there is a change when you perform a search around tags. The change is that before a search was done that exactly matched the tag, currently *also* content is found that contains a sub-tag.

I will show you the difference in this blogpost.

I am going to execute the following search in a CQ5.5 and CQ5.6 environment:


This will find pages that contain the tag 'marketing:interest', this is one of the default tags of the Geometrixx application.

For example here you see the page-properties of the following page "/content/geometrixx/en/products/square.html"


I also enabled the debug log-level for the package. This way we can see the xpath that gets executed in the end in the JCR-repository.


Search results

Here the results if you execute the search statement:





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

The reason for that is that with CQ5.6 if a page contains a sub-tag of the tag that you search, the page will be found.

Xpath statements

Because I have enabled debugging I can see the internal Xpath statement that is executed.

Here you see the two statements:


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


//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.