Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Query for exact non-match

Avatar

Level 7

Hi Team,

I have tag1, tag2, tag3 and tag4. I need the pages which don't have tag4.

Example:

Page 1 has cq:tags=[tag1, tag2]

Page 2 has cq:tags=[tag1, tag4]

In this case, I need only "Page 1" as output but not "Page 2" as it contains tag4.

I used the below query -

path=/content/geometrixx
type=cq:Page
property=jcr:content/cq:tags
property.operation=unequals
property.value=tag4

But it is displaying both the results because Page 2 contains tag1 which is not equal to tag4 which is true. It is displaying even if there is one match (i.e. not equals to tag4 results true for tag1). I need the pages which do not have tag4 at all.

Any idea? Please help me in this.

Thanks,

AryA.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi Arya,

See if the below query works for you.

 

path=/content/geometrixx
type=cq:Page

group.p.not=true

group.property=jcr:content/cq:tags
group.property.operation=equals
group.property.value=tag4

View solution in original post

4 Replies

Avatar

Level 10

I am not sure you can set a query for this exact match - what you may need to do is setup a query looking for the tags and then iterate over result set to exclude pages with this tags. 

Avatar

Correct answer by
Community Advisor

Hi Arya,

See if the below query works for you.

 

path=/content/geometrixx
type=cq:Page

group.p.not=true

group.property=jcr:content/cq:tags
group.property.operation=equals
group.property.value=tag4

Avatar

Level 7

Yes Scott. We thought of doing this way. But if there is more content, I'm suspecting like there might be performance issues because of this. Thanks