Expand my Community achievements bar.

SOLVED

AEM QueryBuilder API: Get the tag names

Avatar

Level 5

I want to query the tag names. Here's my query to get tags:

 

type=cq:tag
path=/content/cq:tags/rally
p.hits=selective
p.properties=jcr:path jcr:title.es jcr:title name

 

However this doesn't return the tag to me:

spidey1405_0-1664433819987.png

 

I also tried to use jcr:name, nodename, and jcr:nodename but none of that seem to work. Can someone help me here? Ideally I would want tags like this:

spidey1405_1-1664433930832.png

 

This is when my hits are selected as all but I just want:

jcr:path, jcr:title, jcr:title.es, and name

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @spidey1405,

This is not possible directly from HTTP Query Builder API. In general HTTP Query Builder API allows you to get all properties that can be accessed using getProperty method from Node API:

The only exception is jcr:path that is supported in different way on Query Builder implementation.

If you will change p.hits to full, you will see all available properties that you can get, assuming they contain some content/value, and of course as you can expect node name is not there.

If you will use Query Builder on java level then getting node name will be possible, having Hit object, you can retrieve Node object and execute getName method. But again this will require some additional steps comparing to other properties.

View solution in original post

1 Reply

Avatar

Correct answer by
Community Advisor

Hi @spidey1405,

This is not possible directly from HTTP Query Builder API. In general HTTP Query Builder API allows you to get all properties that can be accessed using getProperty method from Node API:

The only exception is jcr:path that is supported in different way on Query Builder implementation.

If you will change p.hits to full, you will see all available properties that you can get, assuming they contain some content/value, and of course as you can expect node name is not there.

If you will use Query Builder on java level then getting node name will be possible, having Hit object, you can retrieve Node object and execute getName method. But again this will require some additional steps comparing to other properties.