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

没有正确的解决方案

其他提示

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

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top