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

multiple nodesnames in querybuilder

Avatar

Level 2

I am able to get node path using node name from Query Builder Debbugger, But is it possible to get multiple nodes as result by giving multiple node paths in query

 

the below condition is working fine : 

ashwinka_0-1704956796286.png

but when i give multiple nodenames it not working , its stuck in running search window:

ashwinka_2-1704956919810.png

 

How to search for multiple nodenames

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Level 7

@ashwinka : Are you doing this using querybuilder debugger or creating query using some backend code?

Is there a pattern for your node names for eg- starting with page like page1, page2,..pagen. Then we can do a pattern based search.

Please refer this sheet: https://github.com/paulrohrbeck/aem-links/blob/master/querybuilder_cheatsheet.md


If it is backend code, then you can put your nodename values in something like array/list and then iterate over them to create group predicates.

path=/content/mm/mo
type=cq:Page
group.p.or=true
group.1_nodename=abc
group.2_nodename=xyz
...
group.n_nodename=nnn

 
Lastly, searching for 1000 different nodenames in a single query is not making sense. What are you exactly trying to achieve with this?

View solution in original post

6 Replies

Avatar

Level 7

@ashwinka : You can use group predicate to search with multiple filter conditions.

You can try with:-

 

path=/content/mm/mo
type=cq:Page
group.p.or=true
group.1_nodename=abc
group.2_nodename=xyz

 

It will search for any page having name as 'abc' or 'xyz' under /content/mm/mo path.

Also, in general try to provide specific conditions in order for your query to run faster.

thanks.

Avatar

Level 2

i have more than 1000 nodenames to be searched in query is there any better option like using an array etc?

Avatar

Correct answer by
Level 7

@ashwinka : Are you doing this using querybuilder debugger or creating query using some backend code?

Is there a pattern for your node names for eg- starting with page like page1, page2,..pagen. Then we can do a pattern based search.

Please refer this sheet: https://github.com/paulrohrbeck/aem-links/blob/master/querybuilder_cheatsheet.md


If it is backend code, then you can put your nodename values in something like array/list and then iterate over them to create group predicates.

path=/content/mm/mo
type=cq:Page
group.p.or=true
group.1_nodename=abc
group.2_nodename=xyz
...
group.n_nodename=nnn

 
Lastly, searching for 1000 different nodenames in a single query is not making sense. What are you exactly trying to achieve with this?

Avatar

Level 7

@ashwinka : Do you have 1000 different pages with that many nodenames? OR you have limited nodenames but there could be 1000 such nodes. If so, there is a p.limit=-1 which you can specify in the query and it will return all the matching nodes.

Please let me know if this is what you meant.
thanks.

Avatar

Administrator

@ashwinka, Did you find the suggestions from users helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.



Kautuk Sahni

Avatar

Level 4

Hello @ashwinka 

 

Can you please try this Quary:

 

type=nt:unstructured
path=/content/site1/page1
path=/content/site2/page2
path.flat=true
p.limit=-1

 

In this query, you are specifying two paths, /content/site1/page1 and /content/site2/page2. The query returns all nodes under these paths. The path.flat=true property makes the query return only the nodes that are immediate children of the specified paths.

You can specify as many path= properties as you need with different paths.

 

Thanks,

Venkat