Question

I am using CQ 5.6.1 and want to search pages that are tagged to more than one values of tags. For example: I want to search all the pages that are tagged to:

topicId=investment and language=english and type = something

I can do it for single value of tag like

    searchMap.put(tagid, topicId);
    searchMap.put(tagid.property, @jcr:content/cq:tags);

How can I implement it for more than one values of tags.

Thanks

Ankit

No correct solution

OTHER TIPS

You can add as many tagid's you want by specifying number prefixes like the one's shown below

searchMap.put("type", "cq:Page");
searchMap.put("1_tagid", topicId);
searchMap.put("1_tagid.property", "jcr:content/cq:tags");
searchMap.put("2_tagid", anothertopicId);
searchMap.put("2_tagid.property", "jcr:content/cq:tags");

The above query is similar to the following XPath query

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

For more details on queries, refer this

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top