geofire-android icon indicating copy to clipboard operation
geofire-android copied to clipboard

Query works twice with startAfter(lastVisible) clause.

Open nasirhasanov opened this issue 4 years ago • 0 comments

I am using Geoquery to fetch nearest documents from Firestore in Android/Java. I try to paginate data with recyclerview. But somehow, .startAfter(lastVisible) clause makes the query work twice for different bound tasks. So, after first fetch, all queries works twice.

List<GeoQueryBounds> bounds = GeoFireUtils.getGeoHashQueryBounds(center, radiusInM); final List<Task<QuerySnapshot>> nextTasks = new ArrayList<>(); for (GeoQueryBounds b : bounds) { Query nextQuery = db.collection("posts") .whereEqualTo("country_code", sharedpreferences.getString("country_code", "")) .orderBy("geohash") .startAt(b.startHash) .endAt(b.endHash) .startAfter(lastVisible) .limit(10); nextTasks.add(nextQuery.get()); }

nasirhasanov avatar Aug 28 '21 08:08 nasirhasanov