Query builder for component path | Community
Skip to main content
manikanthar1295
Level 5
April 8, 2022
Solved

Query builder for component path

  • April 8, 2022
  • 3 replies
  • 2118 views

Hi Team,

 

I have need get the all the components in particular path for example 

group.p.or=true

group.1_path=/apps/FirstSiteOne/components

group.2_path=/apps/SecondSiteOne/components

group.3_path=/apps/ThirdSiteOne/components

property=jcr:primaryType
property.value=cq:Component

p.limit=-1

p.hits=selective

p.properties=jcr:title componentGroup componentCategory

 

I am able to get jcr:title componentGroup componentCategory  but not able to get path of componenet

 

How i can get the path of component  i tried with sling:resourceType property but in all component we don't have sling:resourceType

 

If any one know how we can get the path in this scenario plz help 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by lukasz-m

Hi @manikanthar1295,

Please include jcr:path into your p.properties, so the query will look like this:

group.p.or=true
group.1_path=/apps/FirstSiteOne/components
group.2_path=/apps/SecondSiteOne/components
group.3_path=/apps/ThirdSiteOne/components
property=jcr:primaryType
property.value=cq:Component
p.limit=-1
p.hits=selective
p.properties=jcr:title componentGroup componentCategory jcr:path

 

3 replies

Level 2
April 8, 2022

Hi manikanthar1295
For me it's not very clear what you to achieve with your query.
Do you want to get an overview of all your components below the 3 paths

  • /apps/FirstSiteOne/components
  • /apps/SecondSiteOne/components
  • /apps/ThirdSiteOne/components

Or do you want to get an overview of the configured components on content pages?

 

Greetings

Rik

manikanthar1295
Level 5
April 8, 2022

I need the list of component in this path like jcr:title componentGroup componentCategory and Path of componenet  i am not able to get the path of component

Level 2
April 8, 2022

Can you try to add jcr:path in the p.properties?
Based on the query builder documentation that should work

lukasz-m
Community Advisor
lukasz-mCommunity AdvisorAccepted solution
Community Advisor
April 8, 2022

Hi @manikanthar1295,

Please include jcr:path into your p.properties, so the query will look like this:

group.p.or=true
group.1_path=/apps/FirstSiteOne/components
group.2_path=/apps/SecondSiteOne/components
group.3_path=/apps/ThirdSiteOne/components
property=jcr:primaryType
property.value=cq:Component
p.limit=-1
p.hits=selective
p.properties=jcr:title componentGroup componentCategory jcr:path

 

PhaniRajuTanneru
Level 2
April 8, 2022

We can achieve this using groovy. Please check below link.

https://hashimkhan.in/aem-adobecq5-code-templates/groovy-script/

 

Hope this can help!