QueryBuilder with cq:tags not working as expected

susmithasama8

16-09-2019

Hi Team,

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?

Answers (6)

Answers (6)

Arun_Patidar

MVP

16-09-2019

Hi,

Try below:

path=/content/mobile-apps

path.self=false

type=cq:Page

property=jcr:content/cq:tags

property.value=jurassicworldfacts:featured

berliant

Employee

16-09-2019

Can you try to edit your query to something like the one below:

type=cq:PageContent

path.self=false

path=/content/mobile-app

1_group.1_property=cq:tags

1_group.1_property.value=jurassicworldfacts:test

berliant

Employee

19-09-2019

Try the following syntax:

path=/content/mobile-apps

path.self=false

type=cq:PageContent

1_group.1_property=jcr:title

1_group.1_property.value=english asset

1_group.2_property=root/videocomponentapi/text

1_group.2_property.value=%english asset%

1_group.1_property.operation=equal

1_group.2_property.operation=like

1_group.p.or=true

2_group.p.and=true

2_group.3_property=cq:tags

2_group.3_property.1_value=jurassicworldfacts:featured

The resulting query is:

/jcr:root/content/mobile-apps//element(*, cq:PageContent)

[

(@jcr:title = 'english asset' or jcr:like(root/videocomponentapi/@text, '%english asset%'))

and ((@cq:tags = 'jurassicworldfacts:featured.'))

]

susmithasama8

19-09-2019

Hi Arun it helped but now im facing a new problem

here is my total query

path=/content/mobile-apps

path.self=false

type=cq:PageContent

group.1_property=jcr:title

group.1_property.value=english asset

group.2_property=root/videocomponentapi/text

group.2_property.value=%english asset%

group.1_property.operation=equal

group.2_property.operation=like

group.p.or=true

group.3_property=cq:tags

group.3_property.1_value=jurassicworldfacts:featured.

What i want: I need the first 2 groups with or condition and next group with and condition.

i.e; i need results with pages having "english asset" as title or "english asset" in root/videocomponentapi/text and pages with cq:tag=featured.

Can you please help me out?

Right now im getting results with all 3 groups or condition