Created

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:

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

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"

search1

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

search2

Search results

Here the results if you execute 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 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:

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

COMMENTS

ADD A COMMENT