Bug in "Document.Query" with param "currentPageIndex"

Hi,

I'm use Automation Client to connecto to Nuxeo REST API. I use “Document.Query” operation. My client said me that only like 2 Page. The result of search is 2 documents, and pageSize is 5.

I call for first Page with currentPageIndex=1, but when y call to retrieve a second Page with currentPageIndex=2, I obtain the same result.

I think this second time I must obtain a null.

Thanks JMPrieto

0 votes

2 answers

1259 views

ANSWER



Hi José Manuel,

I am using the REST API of automation with Document.Query from REST client (ie. Postman) and results are always OK. In fact, the parameters pageIndex and currentPageIndex are working showing the elements and current page with no problems. I think that the problem could be the setup of parameters on the client. Anyway, I recommend to you, check the Document.Query like me, and check the client source code to ensure that params are setting properly.

You can find the source code of Document.Query automation here:

https://github.com/nuxeo/nuxeo/blob/6.0/nuxeo-features/nuxeo-automation/nuxeo-automation-features/src/main/java/org/nuxeo/ecm/automation/core/operations/services/query/DocumentPaginatedQuery.java

, to ensure the parameters and/or to find any bug from your client.

Hope that helps.

Regards, VS!

3 votes



Thanks Victor,

Your link is broken but help me to find the correct link: https://github.com/nuxeo-archives/nuxeo-features/blob/master/nuxeo-automation/nuxeo-automation-features/src/main/java/org/nuxeo/ecm/automation/core/operations/services/query/DocumentPaginatedQuery.java

Nuxeo not has a BUG. If you request a Query with currentPageIndex= 5 and with pageSize= 5, but the query only return two Documents. The response object is a list of Document. But response object is a PaginatedDocument not a Document. (PaginatedDocument extends Document).

PaginatedDocument has the attribute “currentPageIndex”, and it says 0, not 5.

Thanks.

0 votes



Hi José Manuel,

that broken-link was updated at first, you can find the valid link in my answer.

May be, the currentPageIndex value of document adapter into model list is relative to result pages, not to configuration of the executed query provider. What do you think?

Regards, VS!

03/10/2016

You are in true, but if I request for Apples why Nuxeo response Flowers. I think response must be an Exception. If you request something that I can't have, my response must be "Sorry, Its impossible to satisfy your request because…". Or not?
03/10/2016

When doing paging it's quite common to return 0-sized answers. As documents could have been concurrently removed, it's would be quite bad to crash with an exception just because the page you're now on doesn't have any documents left.
03/31/2016