Hi,
looks like a bug, would you mind sending in a PR for that? Thanks so much.
On Tuesday, July 29, 2014 12:22:19 PM UTC+2, Gwendal Mousset wrote:
>
> Hi all,
>
> I've got an issue with SDN 3.1.0 with pageable parameter.
>
> Here my cypher query :
>
> /**
>
> * Get leaderboard.
>
> * @param pager The pager.
>
> * @return The pagined leaderboard.
>
> */
>
> @Query("MATCH (user:User) "
>
> + "WHERE user.isSubscriber=true AND user.rank IS NOT NULL "
>
> + "RETURN user.id as id, user.firstname as firstname, user.lastname
> as lastname, user.surname as surname, "
>
> + "user.facebookId as facebookId, user.rank as rank,
> sum(user.leaderboardTotalCoins) as coins, user.pictureURL as photoURL")
>
> List<LeaderboardUser> getLeaderboard(Pageable pager);
>
>
> When I execute this query with a pagesize of 2 I see in logs the
> following query, which is not what I expect :
>
>
> Executing remote cypher query: MATCH (user:User) WHERE
> user.isSubscriber=true AND user.rank IS NOT NULL RETURN user.id as id,
> user.firstname as firstname, user.lastname as lastname, user.surname as
> surname, user.facebookId as facebookId, user.rank as rank,
> sum(user.leaderboardTotalCoins) as coins, user.pictureURL as photoURL order
> by user.rank ASC skip 0 *limit 21* params {}
>
>
> And this query returns 21 elements, not 2 !
>
>
> If a execute the query with a pagesize of 3, the limit is 31.
>
>
> So, I found this piece of code that add a "1" in
> org.springframework.data.neo4j.repository.query.CypherGraphRepositoryQuery
>
>
>
> private String addPaging(String baseQuery, Pageable pageable) {
>
> if (pageable==null) {
>
> return baseQuery;
>
> }
>
> return baseQuery + " skip "+pageable.getOffset() + " limit " +
> *pageable.getPageSize()
> + 1* ;
>
> }
>
>
> I imagine that the goal is adding 1 and not "1" (but I don't know why).
>
> In previous releases, there wasn't this +1 and it worked well.
>
>
> So is it a bug or an side effect of an other bug fix/new feature ?
>
>
> Thanks
>
>
>
--
You received this message because you are subscribed to the Google Groups
"Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.