Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

Failed to search two different type's in Query builder

Avatar

Level 4

I want to search two components inside the page structure of every page under the rootpath.

 

keshava219_0-1664517781605.png

By using this predicates its failing to find with "or" its taking "and" condition

 

path=project rootpath
type=nt:unstructured
group.p.or=true
1_property=headingText
1_property.value=Protec%
1_property.operation=like

2_property=paragrapgh
2_property.value=Protec%
2_property.operation=like
p.offset=0
p.limit=-1

 

keshava219_1-1664517984484.png

 

 

how to create params to search entire page including inside the page components with "or" condition

 

1 Accepted Solution

Avatar

Correct answer by
Level 5

'nt:unstructured' should fetch the cq:Page nodes as well, as it's the parent nodeType

 

For adding multiple type, you can try below snippet

 

group.p.or=true
path=project root path
group.1_property=headingText
group.1_property.value=Protec%
group.1_property.operation=like
group.1_group.type=cq:PageContent


group.2_property=paragrapgh
group.2_property.value=Protec%
group.2_property.operation=like
group.2_group.type=dam:Asset

group.3_property=paragrapgh
group.3_property.value=Protec%
group.3_property.operation=like
group.3_group.type=cq:Page


p.offset=0
p.limit=-1

View solution in original post

5 Replies

Avatar

Level 5

path=project path
type=nt:unstructured
group.p.or=true


group.1_property=headingText
group.1_property.value=Protec%
group.1_property.operation=like

group.2_property=paragrapgh
group.2_property.value=Protec%
group.2_property.operation=like


p.offset=0
p.limit=-1

Avatar

Level 4

Hi @poojac35931336,

 

               Thanks for your reply , Its working for type: nt:unstructured 

 

I need query for both type= nt:unstructured and type=cq:Page , In a single query with fulltext

Avatar

Correct answer by
Level 5

'nt:unstructured' should fetch the cq:Page nodes as well, as it's the parent nodeType

 

For adding multiple type, you can try below snippet

 

group.p.or=true
path=project root path
group.1_property=headingText
group.1_property.value=Protec%
group.1_property.operation=like
group.1_group.type=cq:PageContent


group.2_property=paragrapgh
group.2_property.value=Protec%
group.2_property.operation=like
group.2_group.type=dam:Asset

group.3_property=paragrapgh
group.3_property.value=Protec%
group.3_property.operation=like
group.3_group.type=cq:Page


p.offset=0
p.limit=-1

Avatar

Level 4

Yes, I need to search for type=cq:Page at the same time in pageProperties. 

 

ex:

 

in cq:PageContent we have jcr:title and jcr:description also 

Avatar

Employee Advisor

Hi @keshava219 ,

 

You can use nested groups for your usecase, a sample query 

0_group.p.or=true
0_group.1_group.type=dam:AssetContent
0_group.1_group.path=/content/dam/we-retail
0_group.1_group.property=metadata/@dc:format
0_group.1_group.property.value=image/jpeg
0_group.1_group.daterange.property=jcr:lastModified
0_group.1_group.daterange.lowerBound=2015-04-18
0_group.1_group.daterange.lowerOperation=>=
0_group.1_group.1_group.p.or=true
0_group.1_group.1_group.1_fulltext=men
0_group.1_group.1_group.2_fulltext=woman
0_group.2_group.type=cq:PageContent
0_group.2_group.1_group.p.or=true
0_group.2_group.1_group.1_group.1_path=/content/we-retail/language-masters/en
0_group.2_group.1_group.2_group.2_path=/content/we-retail/language-masters/it
0_group.2_group.1_group.1_group.2_property=@hideSubItemsInNav
0_group.2_group.1_group.1_group.2_property.value=true
0_group.2_group.1_group.1_group.2_property.operation=not
0_group.2_group.1_group.2_group.1_property=@jcr:title
0_group.2_group.1_group.2_group.1_property.operation=exists
0_group.2_group.2_group.1_property=@sling:resourceType
0_group.2_group.2_group.1_property.1_value=weretail/components/structure/page
0_group.2_group.2_group.1_property.2_value=weretail/components/structure/product
0_group.2_group.3_group.2_group.p.or=true
0_group.2_group.3_group.2_group.1_fulltext=men
0_group.2_group.3_group.2_group.2_fulltext=woman
orderby=jcr:lastModified
orderby.sort=desc


Understanding of the query :

0_group.1_group = Return nodes dam:AssetContent under /content/dam/we-retail path, modified (jcr:lastModified) after 2015-04-18 that represent an image with mimeType image/jpeg and contains men or woman text inside any of his properties.

0_group.2_group.1_group.1_group = Return content pages nodes (cq:PageContent) from english we-retail site where property hideSubItemsInNav has not got “true” value, his sling:resourceType could be weretail/components/structure/page or weretail/components/structure/product and contains in any of his properties text men or woman.

0_group.2_group.1_group.2_group = Return content pages nodes (cq:PageContent) from italian we-retail site where property jcr:title exists, his sling:resourceType could be weretail/components/structure/page or weretail/components/structure/product and contains in any of his properties men or woman.

Common: All results will be ordered by jcr:lastModified in a descending way.

Note: Predicates under 0_group.2_group are shared in cascade to 0_group.2_group.1_group.1_group & 0_group.2_group.1_group.2_group
more deep groups, for avoiding repeat information.


You can implement a query where you run a query for nt:unstructured & for cq:Page and combine the results.

Hope this helps, thanks!