Query for exact non-match | Community
Skip to main content
Dinu_Arya
Level 6
November 30, 2016
Solved

Query for exact non-match

  • November 30, 2016
  • 4 replies
  • 1593 views

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.

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 Lokesh_Shivalingaiah

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

4 replies

smacdonald2008
Level 10
November 30, 2016

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. 

Lokesh_Shivalingaiah
Lokesh_ShivalingaiahAccepted solution
Level 10
November 30, 2016

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

Dinu_Arya
Dinu_AryaAuthor
Level 6
December 5, 2016

Hi Lokesh,

It's working.

Thanks a lot,

AryA.

Dinu_Arya
Dinu_AryaAuthor
Level 6
December 5, 2016

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