Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Page Totals Are Incorrect When Changing Page Size [DATAGRAPH-1075] #1637

Closed
spring-projects-issues opened this issue Mar 31, 2018 · 7 comments
Closed
Assignees

Comments

@spring-projects-issues
Copy link

@spring-projects-issues spring-projects-issues commented Mar 31, 2018

Mike Whittemore opened DATAGRAPH-1075 and commented

When I request the exact same query, but with different page sizes, the results are often incorrect. For example, a query that matches 4 books will return the wrong number of elements and pages with this URL: /books?size=3

This is what I expect when requesting the first page for various page sizes (the query matches 4 items):

Size totalElements totalPages
20 4
1 4
2 4
3 4

Note that the total elements should always be 4. However, what I receive back is the following:

Size totalElements totalPages
20 4
1 2
2 4
3 6

Note that requesting a size of 1 or 3 (and various other sizes) yields an incorrect number of elements and pages in the page response. A size of 3 yields 6 elements even though there are only 4 available to query.

To be clear, the content of the page is always correct. The page metadata is what is incorrect.


Affects: 5.1 RC1 (Lovelace), 5.0.9 (Kay SR9)

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Sep 6, 2018

Mike Whittemore commented

I see this is resolved but has no fix version yet. Is there a version of Spring Data Neo4J available in Maven central that has this fix or do I need build it myself? Thanks

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Sep 6, 2018

Mike Whittemore commented

Oh I dug into the PR and see I can probably bring in 5.1.0.DATAGRAPH-1075-SNAPSHOT temporarily. Thx

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Sep 6, 2018

Gerrit Meier commented

Thanks for pinging me...it went into the Lovelace RC2. I added the information

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Sep 6, 2018

Mike Whittemore commented

Thanks Gerrit - I definitely prefer pinning to an RC over a SNAPSHOT :)

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Sep 9, 2018

Mike Whittemore commented

Gerrit Meier Hi - are you sure about this going into Lovelace RC2? I just tried it out and the returned page is still incorrect. For example, the totalElements is always twice the value of the page size, and the total pages is always 2 regardless of the actual number of elements available. For example, if I have 127 total elements, I would expect the following with sizes 10 and 100:

Size totalElements totalPages
10 127 11
​100 ​127 ​2

However, what is returned is:

Size totalElements totalPages
​10 20 2
100 200 2

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Sep 9, 2018

Mike Whittemore commented

Note if I don't use a built-in finder, and instead use a @Query, the page metadata is correct, e.g.

@Query(value = "a find query", countQuery = "a count query")
Page<Something> findByWhatever(@Param("whatever") String whatever, Pageable page);
 

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Sep 9, 2018

Mike Whittemore commented

It's possible I just don't know how to hook in the RC to my Maven project correctly as my debugger doesn't hit code in 5.1.0.RC2 so... don't waste any time just yet :) Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants