Skip to main content
Level 4
Feb 20, 2025 5:55 AM UTC
Solved

I want to write a query to traverse through more than 100000(1 lac) nodes

I want to write a query for a groovyscript  to traverse through more than 100000(1 lac) nodes without affecting the performance.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

4 replies

ayush-anand
Level 4
Feb 20, 2025 6:21 AM UTC

Hi @chinmayish ,

 

To efficiently traverse 100,000+ nodes in a Groovy script, ensure relevant properties are indexed. You can create a custom index under in CRXDE. To verify if a query is using an index, check in the Query Debugger tool. 

For best practices, please refer to:

 

Regards,

Ayush

Translate
DPrakashRaj
Community Advisor
Community Advisor
Feb 20, 2025 5:26 PM UTC

best solution is to write an optimize query with proper indexing as suggested by others but iof its one time and you can't create a proper indexing you can try increasing the querylimit as well as explained on https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/what-is-maximum-limit-of-hits-of-querybuilder/m-p/460144

Translate
giuseppebaglio
Level 10
Feb 21, 2025 2:27 PM UTC

For traversing 100,000+ nodes efficiently in a Groovy script, I recommend:

  1. Use ResourceResolver.getResourceResolver() instead of JCR API when possible
  2. Implement batch processing with chunking (process 1000 nodes at a time)
  3. Use JCR-SQL2 queries with appropriate indexing: Make sure your query has proper Oak index coverage to avoid traversal warnings in logs
  4. Consider async processing with Sling Jobs for very large operations
Translate