Joachim Rady
Joachim Rady

Reputation: 1

Overcome the 1000 lines limit in Results on Nuxeo shell

in order to access a nuxeo installation i am using nuxeo shell and run a query

query -uid "SELECT * FROM Document where dc:created > DATE '2022-03-10' and ecm:path STARTSWITH '/default-domain/workspaces/Patricia/Documents' and ecm:primaryType <> 'Folder'  AND ecm:currentLifeCycleState != 'deleted'"

i do get results, but they are limited to 1000 rows.

How do i raise or eliminate this limit ? Or alternatively, how can i run a query in Nuxeo's UI so i can export a list of uid ?

Upvotes: 0

Views: 107

Answers (1)

Konrad
Konrad

Reputation: 1

The issue is that Nuxeo paginates the result, whether you want or not. You could bump up the nuxeo.pageprovider.default-max-page-size (which is set to 1000 by default) but the only real solution is to use multiple calls, each time increasing the currentPageIndex until you are not getting any more results.

As no such option is documented for the Nuxeo shell query command, I doubt it is possible there. So you would need to call the API directly or use one of the Nuxeo clients (e.g. Python, JavaScript)

In Python I did it like this:

def query_paged(nx, query):
    index = 0
    while True:
        query_result = nx.documents.query({"query": query, "currentPageIndex": index})
        page = query_result["entries"]
        if page > 0:
            for entry in page:
                yield entry
        else:
            break
        index += 1

Upvotes: 0

Related Questions