Reputation: 1
I am using Query builder as below to get the list of distinct pages which uses the component (component name will passed as a parameter) in property. I need to pass two parameters, cq:lastReplicationAction=Activate
and sling:resourceType=component
path. I tried above JSON query but no result and it is failing since the component may be used at any level of page node. E.g, /jcr:content/par/component
or /jcr:content/par/mainpar/component
Upvotes: 0
Views: 12734
Reputation: 1
A xpath query can be used to get the pages where a components used.
Goto CRXDELight using http://AEM-AUTHOR-HOST/crx/de/index.jsp, open Tools -> Query. Place the query into the Query box:
/jcr:root/content//*[jcr:contains(@sling:resourceType, 'COMPONENT_NAME/PATH')] order by @jcr:score
if you know exact path of the component then use below query.
/jcr:root/content//*[@sling:resourceType = 'COMPONENT_PATH'] order by @jcr:score
It will return list of paths of content nodes where your component being used. You may split the each path before /jcr:content
to get exact page paths.
Upvotes: 0
Reputation: 384
Components are placed under par node of page, and Replication property is part of page JCR node. That's the reason your query is returning 0 result. Try this query:
http://localhost:4502/bin/querybuilder.json?1_property=jcr:content/par/*/sling:resourceType&1_property.value=<Component-Path>&2_property=jcr:content/cq:lastReplicationAction&2_property.value=Activate&path=<BASE-Content-Path>&type=cq:Page&p.limit=-1
I have used following property to find component: jcr:content/par/*/sling:resourceType If your par node has different name then use correct name of par node.
Upvotes: 4