【发布时间】:2021-05-29 04:04:43
【问题描述】:
有什么方法可以查询firestore db并按距离用户当前位置的距离(升序/降序)返回结果。
https://firebase.google.com/docs/firestore/solutions/geoqueries
上述文档 GeoQuery 返回的文档在范围内,但即使在给出方向后也不按排序顺序。
public Query getDocuments(MainActivity mActivity, GeoQueryBounds bounds) {
return FirebaseFirestore.getInstance()
.collection("user")
.whereEqualTo("type", Integer.valueOf("1"))
.orderBy("geoHash", Query.Direction.ASCENDING)
.startAt(bounds.startHash)
.endAt(bounds.endHash)
.limit(10);
【问题讨论】:
标签: android firebase flutter google-cloud-firestore