NXQL search by API does not sort documents and returns incomplete results

Hi, I am using the REST API to search a Nuxeo LTS2019 document base. This request: https://ged.imt.fr/nuxeo/site/api/v1/search/lang/NXQL/execute?pageSize=1000&PageIndex=1&sortBy=dc:lastModified&sortOrder=DESC&query=SELECT+*+from+Document+WHERE+ecm:primaryType=%27MAC_DOCUMENT_ADMINISTRATIF%27+AND+ecm:isProxy=0+AND+ecm:isVersion=0+AND+ecm:isTrashed=0 returns: {“entity-type”:“documents”, “isPaginable”:true, “resultsCount”:9583, “pageSize”:1000, “maxPageSize”:1000, “resultsCountLimit”:10000, “currentPageSize”:56, “currentPageIndex”:0, “currentPageOffset”:0, “numberOfPages”:10, “isPreviousPageAvailable”:false, “isNextPageAvailable”:true, “isLastPageAvailable”:false, “isSortable”:true, “hasError”:false,“errorMessage”:null, “totalSize”:9583, “pageIndex”:0, “pageCount”:10, “entries”: ( a JSON array of 56 documents )

The problem is:

  • the same request on the webui nxql search interface gives me the correct number of documents, 4898 documents, with, correctly ordered by lastModified time, show me recent documents, for example, one posted today, the 6th of August 2019, as seen on this screen capture: type an image title
  • The answer of the API search tells me I have 9583 documents (resultsCount = 9583)
  • the pagination seems incorrect: the first page, supposed to hold 1000 documents, only contains 56 documents; the next pages, asked by currentPageIndex=1, 2, 3… hold between 100 and 900 documents

What am I doing wrong ?

0 votes

1 answers



The query is not the same on the webui nxql search as the API search. On the WebUI your query includes this clause: ecm:mixinType != 'HiddenInNavigation' but the API call does not. Perhaps this would explain the difference in results.

Are you running the api query as the same user (ie, same permissions) as the nxql query?

0 votes

To fix the sorting, try: sortBy=dc:modified