0

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 programatically, 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.

4

1 Answer 1

0

You may use pagination approach from here: https://helpx.adobe.com/experience-manager/6-3/sites/developing/using/querybuilder-api.html#ExampleQueryBuilderAPIUsage

Pagination is configured in the following way:

// can be done in map or with Query methods
map.put("p.offset", "0"); // same as query.setStart(0) below
map.put("p.limit", "20"); // same as query.setHitsPerPage(20) below

or

query.setStart(0);
query.setHitsPerPage(20);

and go throught result in a loop:

// iterating over the results
for (Hit hit : result.getHits()) {
    String path = hit.getPath();
    ......
}

For more details, please has a look into Implementing pagination on the page provided above.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.