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
Solved! Go to Solution.
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
@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?
@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.
i have more than 1000 nodenames to be searched in query is there any better option like using an array etc?
@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?
@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.
@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.
Views
Replies
Total Likes
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