Query builder help | Community
Skip to main content
Har_Khandelwal
March 4, 2016
Solved

Query builder help

  • March 4, 2016
  • 8 replies
  • 4260 views

Hi,

 

I am trying to search for certain pages based on following criteria:

1. There are multiple paths authored as root path.

2. Each path is further filtered based on a tag field

3. The entire result is filtered to match a certain template

 

Currently, this is what I am trying and not getting anything. Can someone please help me out with a correct approach

group.p.or=true

group.1_path=/content/myproject/path1

group.1_path.flat=true

group.1_property=jcr:content/cq:tags

group.1_property.1_value=stockphotography:animals

group.1_property.2_value=geometrixx-media:events

group.2_path=/content/myproject/path2

group.2_path.flat=true

group.2_property=jcr:content/cq:tags

group.2_property.1_value=forum:topics

group.2_property.2_value=properties:style

property=jcr:content/cq:template

property.value=/apps/myproject/templates/template1

type=cq:Page

p.limit=-1

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 Har_Khandelwal

HI All,

 

I got the problem solved using the below query:

 

type = cq:Page

group.1_group.1_group.path=/content/path1

group.1_group.2_group.property= jcr:content/cq:tags

group.1_group.2_group.property.value = geometrixx-media:events

group.1_group.p.and=true

group.2_group.1_group.path=/content/path2

group.2_group.2_group.property= jcr:content/cq:tags

group.2_group.2_group.property.1_value = stockphotography:animals

group.2_group.2_group.property.2_value = properties:style

group.2_group.p.and=true

group.p.or=true

8 replies

psjaison
March 4, 2016

Hi Khandelwal,

This should work for your use case.

group.p.or=true
group.1_path=/content/geometrixx/en/products
group.2_path=/content/publications/geometrixx-media/geometrixx-unlimited/2013/january/tablet
group.1_tagid=marketing:interest/product
group.1_tagid.property=jcr:content/cq:tags
group.2_tagid=marketing:interest/product
group.2_tagid.property=jcr:content/cq:tags
type=cq:Page
property=jcr:content/cq:template
property.value=/apps/geometrixx/templates/contentpage

 

Thanks,

Jaison

Har_Khandelwal
March 4, 2016

HI Jaison,

Thanks for the help. Tried this as well, this only searches in the one path, not on the second. 

The predicate generated is

{1_path=path: path=/content/geometrixx/en/products, property=jcr:content/cq:tags}
{2_tagid=tagid: tagid=marketing:interest/product, path=/content/publications/geometrixx-media/geometrixx-unlimited/2013/january/tabletgroup.1_tagid=marketing:interest/product, property=jcr:content/cq:tags}

Thanks,

Harshit

Amit_Kumar
March 4, 2016

Har.Khandelwal wrote...

HI Jaison,

Thanks for the help. Tried this as well, this only searches in the one path, not on the second. 

The predicate generated is

{1_path=path: path=/content/geometrixx/en/products, property=jcr:content/cq:tags}
{2_tagid=tagid: tagid=marketing:interest/product, path=/content/publications/geometrixx-media/geometrixx-unlimited/2013/january/tabletgroup.1_tagid=marketing:interest/product, property=jcr:content/cq:tags}

Thanks,

Harshit

 

p.limit=-1
p.hits=selective
group.p.and=true
group.1_group.p.or=true
group.1_group.1_path=/content/path1
group.1_group.2_path=/content/path2
group.2_group.tagid.property=jcr:content/cq:tags
group.2_group.tagid.1_value=stockphotography:animals
group.2_group.tagid.2_value=geometrixx-media:events
group.2_group.p.or=true // put your condition like and etc
group.3_group.p.or=true
group.3_group.1_property=jcr:content/cq:template
group.3_group.1_property.1_value=/apps/myproject/templates/template1

Amit_Kumar
March 4, 2016

Amit_Kumar wrote...

Har.Khandelwal wrote...

HI Jaison,

Thanks for the help. Tried this as well, this only searches in the one path, not on the second. 

The predicate generated is

{1_path=path: path=/content/geometrixx/en/products, property=jcr:content/cq:tags}
{2_tagid=tagid: tagid=marketing:interest/product, path=/content/publications/geometrixx-media/geometrixx-unlimited/2013/january/tabletgroup.1_tagid=marketing:interest/product, property=jcr:content/cq:tags}

Thanks,

Harshit

 

p.limit=-1
p.hits=selective
group.p.and=true
group.1_group.p.or=true
group.1_group.1_path=/content/path1
group.1_group.2_path=/content/path2
group.2_group.tagid.property=jcr:content/cq:tags
group.2_group.tagid.1_value=stockphotography:animals
group.2_group.tagid.2_value=geometrixx-media:events
group.2_group.p.or=true // put your condition like and etc
group.3_group.p.or=true
group.3_group.1_property=jcr:content/cq:template
group.3_group.1_property.1_value=/apps/myproject/templates/template1

 

This will genrate 

ROOT=group: hits=selective, limit=-1[
    {group=group: and=true[
        {1_group=group: or=true[
            {1_path=path: path=/content/path1}
            {2_path=path: path=/content/path2}
        ]}
        {2_group=group: or=true[
            {tagid=tagid: property=jcr:content/cq:tags, 1_value=stockphotography:animals, 2_value=geometrixx-media:events}
        ]}
        {3_group=group: or=true[
            {1_property=property: property=jcr:content/cq:template, 1_value=/apps/myproject/templates/template1}
        ]}
    ]}
]

Har_Khandelwal
March 4, 2016

Amit_Kumar wrote...

Amit_Kumar wrote...

Har.Khandelwal wrote...

HI Jaison,

Thanks for the help. Tried this as well, this only searches in the one path, not on the second. 

The predicate generated is

{1_path=path: path=/content/geometrixx/en/products, property=jcr:content/cq:tags}
{2_tagid=tagid: tagid=marketing:interest/product, path=/content/publications/geometrixx-media/geometrixx-unlimited/2013/january/tabletgroup.1_tagid=marketing:interest/product, property=jcr:content/cq:tags}

Thanks,

Harshit

 

p.limit=-1
p.hits=selective
group.p.and=true
group.1_group.p.or=true
group.1_group.1_path=/content/path1
group.1_group.2_path=/content/path2
group.2_group.tagid.property=jcr:content/cq:tags
group.2_group.tagid.1_value=stockphotography:animals
group.2_group.tagid.2_value=geometrixx-media:events
group.2_group.p.or=true // put your condition like and etc
group.3_group.p.or=true
group.3_group.1_property=jcr:content/cq:template
group.3_group.1_property.1_value=/apps/myproject/templates/template1

 

This will genrate 

ROOT=group: hits=selective, limit=-1[
    {group=group: and=true[
        {1_group=group: or=true[
            {1_path=path: path=/content/path1}
            {2_path=path: path=/content/path2}
        ]}
        {2_group=group: or=true[
            {tagid=tagid: property=jcr:content/cq:tags, 1_value=stockphotography:animals, 2_value=geometrixx-media:events}
        ]}
        {3_group=group: or=true[
            {1_property=property: property=jcr:content/cq:template, 1_value=/apps/myproject/templates/template1}
        ]}
    ]}
]

 

Hi,

 

This still does not solve the purpose. This searches for 2 paths, then performs tag search in the overall result. What I am trying to do is search for all stockphotography:animals in path 1 and geometrixx-media:events in path 2. There might be more tags in each path

Amit_Kumar
March 4, 2016

p.limit=-1
p.hits=selective
group.p.or=true
group.1_group.p.or=true
group.1_group.1_path=/content/path1
group.1_group.tagid.property=jcr:content/cq:tags
group.1_group.tagid.1_value=geometrixx-media:events
group.2_group.tagid.property=jcr:content/cq:tags
group.2_group.tagid.1_value=stockphotography:animals
group.2_group.1_path=/content/path2
group.2_group.p.or=true
group.3_group.p.or=true
group.3_group.1_property=jcr:content/cq:template
group.3_group.1_property.1_value=/apps/myproject/templates/template1

this will give you what you asked and you can play with it to suit your exact requirements or post all requirement here as In Your original question you didn't provided all details which created all this confusion.

ROOT=group: hits=selective, limit=-1[
    {group=group: or=true[
        {1_group=group: or=true[
            {tagid=tagid: property=jcr:content/cq:tags, 1_value=geometrixx-media:events}
            {1_path=path: path=/content/path1}
        ]}
        {2_group=group: or=true[
            {tagid=tagid: property=jcr:content/cq:tags, 1_value=stockphotography:animals}
            {1_path=path: path=/content/path2}
        ]}
        {3_group=group: or=true[
            {1_property=property: property=jcr:content/cq:template, 1_value=/apps/myproject/templates/template1}
        ]}
    ]}
]

Har_Khandelwal
Har_KhandelwalAuthorAccepted solution
March 10, 2016

HI All,

 

I got the problem solved using the below query:

 

type = cq:Page

group.1_group.1_group.path=/content/path1

group.1_group.2_group.property= jcr:content/cq:tags

group.1_group.2_group.property.value = geometrixx-media:events

group.1_group.p.and=true

group.2_group.1_group.path=/content/path2

group.2_group.2_group.property= jcr:content/cq:tags

group.2_group.2_group.property.1_value = stockphotography:animals

group.2_group.2_group.property.2_value = properties:style

group.2_group.p.and=true

group.p.or=true

Himanshu_Singhal
Community Advisor
Community Advisor
March 10, 2016

Is there any way to implement partial text search using querybuilder?