Relational query and near - Order by distance - parse.com

Friday, July 4, 2014

I'm dealing with an issue and I can't solve it, here we go:


I have exactly the same problem as described here, I tried Fosco Marotto's solution (He's a Parser) but didn't work :


http://ift.tt/1klqLXd


My current situation: I have a class ITEM with a Pointer to another class USER which have a field "location" that is a GeoPoint.


All I want is to show all the items near of a given location order by nearest first.


Here's my query:



ParseQuery mUserQuery = ParseQuery.getQuery(User.class);
mUserQuery.whereNear("location",myLocation);

ParseQuery mItemsParseQuery = ParseQuery.getQuery(Item.class);
mItemsParseQuery.include("user");
mItemsParseQuery.whereMatchesQuery("user",mUserQuery);


It works, but items retrieved are not sort by distance


It's possible to do that? Some suggestions?


Thanks!!!







http://ift.tt/1zctbRU