0
votes

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

https://host:port/bin/querybuilder.json?1_property=sling:resourceType&1_property.value=COMPONENTPATH&2_property=jcr:content/cq:lastReplicationAction&2_property.value=Activate&path=FROM_WHICH_CONTENT_PATH&type=cq:Page&p.limit=-1

2
Provide please real params, may there is wrong components pathcylinder.y
If you need a list of pages with a specific component you can use the OOTB functionality provided at http://localhost:4502/libs/wcm/core/content/sites/components.html (see the Live Usage tab) or a lamer (classic ui) version at http://localhost:4502/etc/reports/compreport.html You can also call the underlying Live Usage servlet directly with the resource type: http://localhost:4502/libs/wcm/core/content/sites/components/details/liveusage.0.40.html/apps/weretail/components/structure/productfilterccpizza

2 Answers

4
votes

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.

0
votes

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.