I have built my app on Parse, and recently added support for finding nearby objects using ParseGeoPoints.
I have 2 queries:
ParseQuery<Stitch> query = new ParseQuery<Stitch>("Stitch");
query.whereEqualTo("complete", false);
query.whereNotEqualTo("archived", ParseUser.getCurrentUser().getUsername());
query.whereEqualTo("invited", ParseUser.getCurrentUser().getUsername());
ParseQuery<Stitch> nearby = new ParseQuery<Stitch>("Stitch");
nearby.whereWithinMiles("location", app.currentLocation, 0.1);
nearby.whereExists("location");
nearby.whereEqualTo("complete", false);
nearby.whereEqualTo("allowNearby", true);
nearby.whereNotEqualTo("invited", ParseUser.getCurrentUser().getUsername());
I add these to a list:
List<ParseQuery<Stitch>> queries = new ArrayList<ParseQuery<Stitch>>();
queries.add(query);
queries.add(nearby);
ParseQuery<Stitch> combined = ParseQuery.or(queries);
combined.orderByDescending("updatedAt");
combined.include("author");
However, this query returns some really strange results--namely it ignores the constraints on the nearby query, and returns Stitches at ALL locations in the world. If I remove the first query from the ParseQuery.or() I get the right results from nearby.
Is ParseQuery.or() combining these strangely on Android? Can anyone help? Thanks!
Final answer here is Parse does not support a GeoQuery in a compound query, even though no warning is given. You will need to issue 2 queries in this scenario and merge the results yourself.