multiple nodesnames in querybuilder | Community
Skip to main content
ashwinka
New Participant
January 11, 2024
Solved

multiple nodesnames in querybuilder

  • January 11, 2024
  • 3 replies
  • 1495 views

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 : 

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

 

How to search for multiple nodenames

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 Kamal_Kishor

@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?

3 replies

New Participant
January 11, 2024

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

kautuk_sahni
Employee
January 11, 2024

@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
Kamal_Kishor
New Participant
January 11, 2024

@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.

ashwinka
ashwinkaAuthor
New Participant
January 11, 2024

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

Kamal_Kishor
Kamal_KishorAccepted solution
New Participant
January 11, 2024

@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?