This is a Geoquery for Firestore: https://github.com/imperiumlabs/GeoFirestore-Android But it doesn't allow for further sorting. I want to sort by the nearest and most famous users, how could i do such a thing? Are there any other possible libraries?
Geofire already does something seemingly impossible on Firestore: it performs a range query on two values (lat and lon). It does this by creating a geohash value, which combines the latitude and longitude into a single value, that can be used to select a range of documents that are close to each other.
To allow additionally select on the range of another field, you'd have to find a way to combine the value of that other field into the Geohash value. It essentially means you have to find a way to express the importance of fame (your additional property) as a function of location (the distance), and compute a single field value based on that. While this may technically possible, I doubt anyone has every done it.
To learn how filtering on location works (and why adding an extra field is not as simple as it may seem), have a look at:
- the video of my talk on geofiltering on Firestore
- Jeff's much more concise Realtime GeoQueries With Firestore video and article
- Firebase/GeoFire - Most popular item at location
来源:https://stackoverflow.com/questions/55329334/how-can-i-use-a-geoquery-to-sort-by-both-location-and-certain-value-android