AEM Preicate query with cq: tags

mjb54261515

08-05-2019

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/ad...

https://helpx.adobe.com/experience-manager/6-3/sites/developing/using/querybuilder-predicate-referen...

Thank You

Accepted Solutions (1)

Accepted Solutions (1)

Arun_Patidar

MVP

10-05-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

Answers (5)

Answers (5)

susmithasama8

16-09-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?

rachanam1547401

10-05-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