Expand my Community achievements bar.

SOLVED

QueryBuilder with cq:tags not working as expected

Avatar

Level 2

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?

1 Accepted Solution

Avatar

Correct answer by
Community Advisor
7 Replies

Avatar

Employee

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

Avatar

Employee Advisor

Agreed with Leo, the query works without issues. More details on how to use query builder tool at [1]

[1] CQ-OPS - How to Use CQ's Query Debugger Tool

Avatar

Community Advisor

Hi,

Try below:

path=/content/mobile-apps

path.self=false

type=cq:Page

property=jcr:content/cq:tags

property.value=jurassicworldfacts:featured



Arun Patidar

Avatar

Level 2

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

Avatar

Employee

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.'))

]

Avatar

Correct answer by
Community Advisor