Combine Querybuilder results for multiple queries | Community
Skip to main content
Level 5
October 2, 2020
Solved

Combine Querybuilder results for multiple queries

  • October 2, 2020
  • 1 reply
  • 2291 views

Hello Community - I am looking for the solution to combine the results of below two queries together. If I execute the query-1 and query-2 separately, I get the results but I am looking for the results which include the results from query-1 + query-2. Can someone provide some inputs on this?

 

path=/content/we-retail/us/en/equipment/jcr:content

1_property=sectionPath
1_property.value=%/content/experience-fragments/%
1_property.operation=like

 

2_property=subSectionPath
2_property.value=%/content/experience-fragments/%
2_property.operation=like

 

p.limit=-1

 

Also I am looking for the solution for another query which searches for the multiple paths for the specific property and the results should includes the results from the different paths together.


path=/content/we-retail/us/en/equipment/jcr:content
path=/content/we-retail/us/es/equipment/jcr:content
path=/content/we-retail/ca/fr/equipment/jcr:content
path=/content/we-retail/de/de/equipment/jcr:content
path=/content/we-retail/fr/fr/equipment/jcr:content
path=/content/we-retail/it/it/equipment/jcr:content

 

1_property=sectionPath
1_property.value=%/content/experience-fragments/%
1_property.operation=like

 

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 Vijayalakshmi_S

Hi @v1101

To bring in all pages which has both property sectionPath and subSectionPath, then using the predicates as is as a single query predicates set should work. 

But if you are looking for pages which has either sectionPath or subSectionPath, then we need to group properties and enable "or". (group.p.or) Something like below

 

path=/content/we-retail/language-masters/en/experience type=cq:Page group.1_property=@jcr:content/jcr:title group.1_property.operation=exists group.2_property=@jcr:content/cq:tags group.2_property.operation=exists group.p.or=true p.limit=-1

 

 Second, for combining paths, you can use same group concept - group paths and specify "or" as below

 

group.1_path=/content/we-retail/language-masters/en/experience group.2_path=/content/we-retail/language-masters/es/experience group.3_path=/content/we-retail/language-masters/de/experience group.4_path=/content/we-retail/language-masters/fr/experience group.p.or=true 1_property=@jcr:content/jcr:title 1_property.operation=exists p.limit=-1 type=cq:Page

 

I suggest to use querydebug.html(http://localhost:4502/libs/cq/search/content/querydebug.html) to execute the predicates which will display its equivalent XPATH query framed in right hand section and will help understand how the conditions are framed 

1 reply

Vijayalakshmi_S
Vijayalakshmi_SAccepted solution
Level 10
October 2, 2020

Hi @v1101

To bring in all pages which has both property sectionPath and subSectionPath, then using the predicates as is as a single query predicates set should work. 

But if you are looking for pages which has either sectionPath or subSectionPath, then we need to group properties and enable "or". (group.p.or) Something like below

 

path=/content/we-retail/language-masters/en/experience type=cq:Page group.1_property=@jcr:content/jcr:title group.1_property.operation=exists group.2_property=@jcr:content/cq:tags group.2_property.operation=exists group.p.or=true p.limit=-1

 

 Second, for combining paths, you can use same group concept - group paths and specify "or" as below

 

group.1_path=/content/we-retail/language-masters/en/experience group.2_path=/content/we-retail/language-masters/es/experience group.3_path=/content/we-retail/language-masters/de/experience group.4_path=/content/we-retail/language-masters/fr/experience group.p.or=true 1_property=@jcr:content/jcr:title 1_property.operation=exists p.limit=-1 type=cq:Page

 

I suggest to use querydebug.html(http://localhost:4502/libs/cq/search/content/querydebug.html) to execute the predicates which will display its equivalent XPATH query framed in right hand section and will help understand how the conditions are framed 

v1101Author
Level 5
October 2, 2020
@ Vijayalakshmi_S Thanks for the prompt response. Appreciate it.