Search code examples
aemquery-buildersling

How to include Tag names in AEM search query builder while Tag IDs are saved in the repository


In AEM, how can we write a query as the default search works, where a Tag ID is saved for an asset, while the user wanted to search by the Tag Name/jcr:title?

For example, we can search for assets that has a particular Tag assigned. As below:

enter image description here

the way there are assigned is as follows:

enter image description here

And are saved in the repository as ID's.. as below:

enter image description here

For example, a tag hierarchy:

TAG ID:

/etc/tags/SXM/shows/entertainment/kids/8216/1073743514

The TAG NAME for the above:

SXM > Shows > Talk > Kids > Kids Place Live > Weird Al April

I tried the below but does not work?

type=dam:Assets
path=/content/dam/
tagsearch=SXM:Shows/Talk/Kids/Kids Place Live/Weird Al April

Solution

  • I was able to resolve this and posting the answer.

    There is a predicate tagsearch that would build the tag hierarchy to the search query.

    The below worked for me:

    type=dam:Assets  
    path=/content/dam/  
    tagsearch=Weird Al April  
    

    or

    type=dam:Assets   
    path=/content/dam/  
    tagsearch=Kids Place Live
    

    or

    type=dam:Assets  
    path=/content/dam/  
    tagsearch=Kids  
    

    enter image description here