Run AEM Query-builder query in batch | Community
Skip to main content
tarun11011991
Level 2
May 6, 2020
Solved

Run AEM Query-builder query in batch

  • May 6, 2020
  • 1 reply
  • 5102 views

I have the below working query

path=/content/dam
type=sling:OrderedFolder
nodename=[0-9][0-9][0-9][0-9]-([0-9][0-9][0-9][0-9]|[0-9][0-9][0-9][0-9][0-9])
property=jcr:content/metadataprofile
property.operation=exists
property.value=false
p.limit=-1

It runs on entire Path=/content/dam, so it traverse all nodes for about 20 minutes and gives results.

How can i make it in batches when using query-builder API code-wise, like - traverse 1000 nodes and do-something code-wise and then continue with query and traversing next 1000 nodes and so-on ? Is it possible ?
Thanks in advance.

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 arunpatidar

Hi,

You can combine offset, guessTotal and limit

https://helpx.adobe.com/experience-manager/6-3/sites/developing/using/querybuilder-api.html

1 reply

arunpatidar
Community Advisor
arunpatidarCommunity AdvisorAccepted solution
Community Advisor
May 6, 2020
tarun11011991
Level 2
May 19, 2020
Should i give P.limit and p.guessTotal as some random number OR should I assign guessTotal as SearchResult.getTotalMatches() ? As i don't want my code to stop after certain number of nodes and want it to run completely without missing any nodes. Can you share sample java code using implementing that?