Example: Get top rated restaurants around me based on rating count
(Assume 10k restaurants around the area, so have to use limit)
My Query in Java:
ref.orderBy("geoHash")
.orderBy("count", Query.Direction.DESCENDING)
.startAt(startHash)
.endAt(endHash)
.limit(limit)
But it doesn't works as expected even for a single GeoQueryBound.
Sample Document :
item1 : {
geoHash : tsp1
count : 100
}
item2 : {
geoHash : tsp1
count : 200
}
item3 : {
geoHash : tsp2
count : 300
}
Now if we run the above query with geo bounds as tsp0 - tsp3 with limit as 2
Expected Results : [item3, item2]
Actual Results : [item2, item1]
Is this a limitation in firestore? Is there any workaround for it.