Fetch all tags of all assets under a folder | Community
Skip to main content
Level 2
May 8, 2023
Solved

Fetch all tags of all assets under a folder

  • May 8, 2023
  • 4 replies
  • 1274 views

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 ?

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 BrianKasingli

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

 

4 replies

Shiv_Prakash_Patel
Community Advisor
Community Advisor
May 8, 2023

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

Shiv Prakash
Himanshu_Jain
Community Advisor
Community Advisor
May 8, 2023

Use query builder api to fetch all assets with tags under the folder.

 

Ref: https://experienceleague.adobe.com/docs/experience-manager-65/assets/JCR_query_cheatsheet-v1.1.pdf?lang=en

 

Himanshu Jain
Sady_Rifat
Community Advisor
Community Advisor
May 8, 2023

Hello @ayushag3 ,
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.

BrianKasingli
Community Advisor and Adobe Champion
BrianKasingliCommunity Advisor and Adobe ChampionAccepted solution
Community Advisor and Adobe Champion
May 8, 2023

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