AEM Preicate query with cq: tags | Community
Skip to main content
manoj_devapath
New Participant
May 9, 2019
Solved

AEM Preicate query with cq: tags

  • May 9, 2019
  • 6 replies
  • 13090 views

I am trying to get article pages tagged with only specified cq: tags. I Followed following documentation and ACS Commons Git references.

When I execute query in predicate query console it works fine. It returns me only articles only with required tags.where as when I run query in java code. I get search results of all pages.

Please advise which I am missing.

path=/content/apples/en

type=cq:Page

property=@jcr:content/sling:resourceType

property.value=apples/components/page/article

tagid.property=jcr:content/cq:tags

tagid.1_value=namespace-a:some/tag

tagid.2_value=namespace-a:some/other/tag

orderby=@jcr:content/date

orderby.sort=desc

p.offset=0

p.limit=-1

// Tag Predicate - this has been moved into an impl package so Javadocs are not generated for it.

        map.put("tagid.property", "jcr:content/cq:tags"); // Default is 'cq:tags'

        map.put("tagid.1_value", "namespace-a:some/tag"); // Note the #_ prefix for values is required.

        map.put("tagid.2_value", "namespace-a:some/other/tag");

https://github.com/Adobe-Consulting-Services/acs-aem-samples/blob/master/bundle/src/main/java/com/adobe/acs/samples/search/querybuilder/impl/SampleQueryBuilder.java

https://helpx.adobe.com/experience-manager/6-3/sites/developing/using/querybuilder-predicate-reference.html#tagid

Thank You

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 arunpatidar

Can you try with below query

path=/content/we-retail

type=cq:Page

orderby=@jcr:score

orderby.sort=desc

1_property=jcr:content/cq:tags

1_property.1_value=we-retail:equipment

1_property.2_value=we-retail:season/summer

2_property=jcr:content/sling:resourceType

2_property.value=weretail/components/structure/page

orderby=@jcr:content/date

orderby.sort=desc

6 replies

arunpatidar
New Participant
September 16, 2019

Hi,

Try below:

path=/content/mobile-apps

path.self=false

type=cq:Page

property=jcr:content/cq:tags

property.value=jurassicworldfacts:featured

Arun Patidar
New Participant
August 7, 2023

Hi @arunpatidar 

What should be the query if i want to return the tag value for CF's under certain paths..

arunpatidar
New Participant
August 8, 2023

I think you just need to change the path predicate

e.g.

path=/content/dam/my-project/content-fragment-path/xyz

Arun Patidar
New Participant
September 16, 2019

Hi Arun,

Im getting all the pages with cqtag "jurassicworldfacts:featured"(since i have that tag added to pages). Now i dont have a tag called "jurassicworldfacts:test".

If i give that value in the below query im getting all the results(pages). ideally i should not get any results since i dont have that tag at all.

path=/content/mobile-apps

path.self=false

type=cq:PageContent

tagid.property=cq:tags

tagid.1_value=jurassicworldfacts:test

Am i missing something here?

Can you please help me on this?

New Participant
May 10, 2019

Hi,

you can try something like this

1_tagid.property=jcr:content/cq:tags

1_tagid.1_value=we-retail:equipment

1_tagid.2_value=we-retail:season/summer

arunpatidar
arunpatidarAccepted solution
New Participant
May 10, 2019

Can you try with below query

path=/content/we-retail

type=cq:Page

orderby=@jcr:score

orderby.sort=desc

1_property=jcr:content/cq:tags

1_property.1_value=we-retail:equipment

1_property.2_value=we-retail:season/summer

2_property=jcr:content/sling:resourceType

2_property.value=weretail/components/structure/page

orderby=@jcr:content/date

orderby.sort=desc

Arun Patidar
manoj_devapath
New Participant
May 9, 2019

NOT really. That did not work Arun Patidar

arunpatidar
New Participant
May 9, 2019

Please check Query Builder API

You may need to update your code

map.put("tagid.property", "jcr:content/@cq:tags");

Arun Patidar