Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session
SOLVED

Fetch all tags of all assets under a folder

Avatar

Level 2

Hi All,

 

I have a requirement to choose a DAM Folder path which can contain n number of assets and each asset may or may not be tagged in its asset properties. I have to fetch the superset of tags of all assets under the folder using query manager API. Can anybody help with this ?

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Here's the query for finding all dam:Asset objects which does not have any tags configured. In layman's terms, find me all assets under the /content/dam/sourcedcode folder, where cq:tags does not exists.

 

type=dam:Asset
path=/content/dam/sourcedcode
property=jcr:content/metadata/cq:tags
property.operation=exists
property.value=false
p.limit=-1

 

View solution in original post

4 Replies

Avatar

Community Advisor

Are you looking for all non-duplicate tags authored in asset properties for a given folder?

Shiv Prakash

Avatar

Community Advisor

Hello @ayush_aem ,
For this requirement you can use,

path=/content/dam/my-project/image
property=jcr:content/metadata/cq:tags
property.operation=exists
p.limit=-1

By this query, you will get all the dam paths that have tags.
Then resolve the path resource (path/jcr:content/metadata/cq:tags) and get tags.

 

For the unique tags value get the Tag first and put it on a set.

Avatar

Correct answer by
Community Advisor

Here's the query for finding all dam:Asset objects which does not have any tags configured. In layman's terms, find me all assets under the /content/dam/sourcedcode folder, where cq:tags does not exists.

 

type=dam:Asset
path=/content/dam/sourcedcode
property=jcr:content/metadata/cq:tags
property.operation=exists
property.value=false
p.limit=-1