How can I use a GeoQuery to sort by both location and certain value? (Android)

僤鯓⒐⒋嵵緔 提交于 2019-12-02 11:02:51

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:

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!