Using querybuilder to retrieve all assets with particular property

Avatar

Avatar
Level 1
AnshuSingh2701
Level 1

Likes

0 likes

Total Posts

5 posts

Correct reply

0 solutions
View profile

Avatar
Level 1
AnshuSingh2701
Level 1

Likes

0 likes

Total Posts

5 posts

Correct reply

0 solutions
View profile
AnshuSingh2701
Level 1

24-07-2020

Hi everyone,

I have a requirement where I need to search for all the assets with a particular property. I am trying to use Query Builder API for it. My assets are under multiple different folders under /content/dam. They can be in /content/dam/abc or /content/dam/abc/def or even /content/dam/ghi. There can be multiple child folders or parallel folders where my assets are present. How do I search for all assets which have one property in common in all these different paths? If I use path=/content/dam in my query, it doesn't give any result as all my assets are in one or the other folder but since there are multiple folders I cannot give one definite path. I am using AEM 6.4.2

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Establish
MVP
BrianKasingli
MVP

Likes

645 likes

Total Posts

607 posts

Correct reply

239 solutions
Top badges earned
Establish
Ignite 1
Give Back 5
Give Back 3
Give Back 10
View profile

Avatar
Establish
MVP
BrianKasingli
MVP

Likes

645 likes

Total Posts

607 posts

Correct reply

239 solutions
Top badges earned
Establish
Ignite 1
Give Back 5
Give Back 3
Give Back 10
View profile
BrianKasingli
MVP

24-07-2020

@AnshuSingh2701,

Where you are querying, /content/dam, will show you 0 results, it maybe because your AEM platform has reached the maximum node traversal, LimitReads of 10,000. You will need to change the limit from your environment's system/console, but please be warned as when you increase this number, it may affect the overall performance.

http://localhost:4502/system/console/jmx/org.apache.jackrabbit.oak%3Aname%3Dsettings%2Ctype%3DQueryE...

Screenshot 2020-07-24 at 18.11.47.png

Give this a try.

 

Answers (2)

Answers (2)

Avatar

Avatar
Establish
MVP
Nupur_Jain
MVP

Likes

165 likes

Total Posts

186 posts

Correct reply

76 solutions
Top badges earned
Establish
Ignite 1
Give Back 5
Give Back 3
Give Back 25
View profile

Avatar
Establish
MVP
Nupur_Jain
MVP

Likes

165 likes

Total Posts

186 posts

Correct reply

76 solutions
Top badges earned
Establish
Ignite 1
Give Back 5
Give Back 3
Give Back 25
View profile
Nupur_Jain
MVP

24-07-2020

Hi @AnshuSingh2701 

 

In order to find for all assets with particular property, you can use

path=/content/dam
type=dam:Asset
property=jcr:content/metadata/dc:format
property.value=image/png
p.limit=-1

 

The above query should search in depth to get all assets.

 

If you are looking for defining multiple paths in query, you can use something like that:

 

group.p.or=true
group.1_path=/content/dam/we-retail-screens
group.2_path=/content/dam/we-retail
property=jcr:content/metadata/dc:format
property.value=image/png
p.limit=-1

 

Hope it helps!

Thanks!

Nupur

Avatar

Avatar
Establish
MVP
Veena_Vikram
MVP

Likes

484 likes

Total Posts

1,049 posts

Correct reply

121 solutions
Top badges earned
Establish
Coach
Contributor 2
Seeker
Ignite 5
View profile

Avatar
Establish
MVP
Veena_Vikram
MVP

Likes

484 likes

Total Posts

1,049 posts

Correct reply

121 solutions
Top badges earned
Establish
Coach
Contributor 2
Seeker
Ignite 5
View profile
Veena_Vikram
MVP

24-07-2020

Hi @AnshuSingh2701 

 

   Can you share the query you are trying now ? If you are giving path as /content/dam , it should eventually look under evry folder below dam . So the issue might be with the rest of the properties you are giving. @Nupur_Jain has put some sample queries. Please check if any of those helps ?

 

Thanks

Veena