AEM Querybuilder - How to return only the folders under a path? | Community
Skip to main content
ksuren
Level 3
June 1, 2018
Solved

AEM Querybuilder - How to return only the folders under a path?

  • June 1, 2018
  • 4 replies
  • 4769 views

I'm trying to rerun only the folders from a given path using query builder on AEM

Query:

path=/content/dam/we-retail/en

type=sling:OrderedFolder

p.hits=selective

p.nodedepth=1

p.limit=-1

Or URL

http://localhost:4502/bin/querybuilder.json?p.hits=selective&p.limit=-1&path=%2fcontent%2fdam%2fwe-retail%2fen&type=slin…

The query returns 35 records, while there are only 6 folders under /content/dam/we-retail/en. How can i return only these 6?

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 arunpatidar

Hi,

You use below query

type=nt:base

path=/content/dam/we-retail/en

property=jcr:primaryType

property.1_value=sling:OrderedFolder

property.2_value=sling:Folder

path.flat=true

p.hits=selective

p.properties=jcr:path

add more value for property like property.X_value if you want to include more types.

Thanks

Arun

4 replies

smacdonald2008
Level 10
June 1, 2018

I tested this -- ocalhost:4502/libs/cq/search/content/querydebug.htm

I have 20 components under here:

Used this query and it returned the correct results..

ksuren
ksurenAuthor
Level 3
June 1, 2018

I'm looking to return folders and using "sling:OrderedFolder" or "sling"Folder", query returning sub-folders also. I wanted only top level under "/content/dam/we-retail/en"

arunpatidar
Community Advisor
arunpatidarCommunity AdvisorAccepted solution
Community Advisor
June 1, 2018

Hi,

You use below query

type=nt:base

path=/content/dam/we-retail/en

property=jcr:primaryType

property.1_value=sling:OrderedFolder

property.2_value=sling:Folder

path.flat=true

p.hits=selective

p.properties=jcr:path

add more value for property like property.X_value if you want to include more types.

Thanks

Arun

Arun Patidar
ksuren
ksurenAuthor
Level 3
June 2, 2018

Works like a charm.. thanks arunp99088702​ , saved me a ton of time!