Start a new topic

query with sort and limit


I have a list of users and I'm trying to load them in a listview. First I'm Ioading 10 users and then the listview has onScrollListener where I load more. I've succeeded this part with:



But now I want to sort all the data (alphabetically) before it loads.

I've tried with:

q.addSort("full_name", AbstractQuery.SortOrder.ASC);

Let's say we have the next list: a, b, a, c, b, a;

After adding the sort the result is: a, a, b, c, a, b;


just to confirm, is your query:

q.addSort("full_name", AbstractQuery.SortOrder.ASC).setLimit(limit).setSkip(skip)?
Hi Edward,

Yes, that's my query... I thought it was a problem with limit and skip but the limit is set to 10 and sort works for more than 20 records...after that it happens like in the eg. that I gave
There might be another issue here. Can you take a look at our troubleshooting guide and enable debug logging, and then post the http request and response for the queries?
2132-2149/com..... D/HttpTransport? -------------- REQUEST --------------


Accept-Encoding: gzip


User-Agent: android-kinvey-http/2.6.15

x-kinvey-api-version: 3

x-kinvey-device-information: Genymotion/Google_Nexus_5_-_4.4.2_-_API_19_-_1080x1920 Android 4.4.2

11-12 09:42:01.500 2132-2149/com..... D/HttpTransport? -------------- RESPONSE --------------

200 OK

Connection: keep-alive

Content-Length: 5699

Content-Type: application/json; charset=utf-8

Date: Wed, 12 Nov 2014 07:42:01 GMT

Server: ngx_openresty

X-Android-Received-Millis: 1415778121501

X-Android-Response-Source: NETWORK 200

X-Android-Selected-Transport: http/1.1

X-Android-Sent-Millis: 1415778121308

X-Kinvey-API-Version: 3

X-Kinvey-Request-Id: fe69be731d974aecacdfc92601d6d587

X-Powered-By: Express

11-12 09:42:01.740 2132-2149/com....D/HttpTransport? Total: 5,699 bytes
Is it possible that every entity doesn't have the `full_name` field populated?

Can you give us a sample subset of the some of the data with the full_name field so we can reproduce it?

Also-- that above request you posted does look correct, although it doesn't contain a `skip`.
All the fields in full_name are populated. The skip is missing because I am adding it on the second call. When I scroll over 10 entries I add q.skip(10) and the get users thread starts again. Edward is it possible to send you a subset of data on an email address?

I can confirm this happening on iOS. I had a simple request with skip and limit and after adding the modifier like this:

`KCSQuerySortModifier* nameSort = [[KCSQuerySortModifier alloc] initWithField:@"full_name" inDirection:kKCSAscending];

[query addSortModifier:nameSort];`

I get mix results. More exactly, for the first query I get entities that have full_name starting with "b" and "v" and only after that, from the second request onward, I get them ordered.

Indeed: sorting does not work with skip and limit on both Android and iOs apis.

Any news here?
Login or Signup to post a comment