AEM QueryBuilder API: Get the tag names | Community
Skip to main content
Level 4
September 29, 2022
Solved

AEM QueryBuilder API: Get the tag names

  • September 29, 2022
  • 1 reply
  • 1936 views

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:

 

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:

 

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

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

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 lukasz-m

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.

1 reply

lukasz-m
Community Advisor
lukasz-mCommunity AdvisorAccepted solution
Community Advisor
September 29, 2022

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.