Can I use firebase's GeoFire with Priority in a single query?

非 Y 不嫁゛ 提交于 2019-12-08 10:34:18

问题


I'd like to query my data with a query that will return me everything on a radius (geofire can find that alright) but also within a datetime window.

At the moment I'm storing datetimes as priorities, so it's quite easy to query the array asking for data between 2 priority numbers (corresponding to start/end datetimes).

It's also quite easy to put my data in a GeoFire array and then query it to get the radius.

Can I combine those 2 though? In an easy not too hacky way?

Cheers


回答1:


Not with a single query. You must either filter client side, or do your query in more than one phase.

This is because:

  • Each node is limited to a single priority value.
  • Per this blog post, GeoFire uses the priority to store a geohash, which it uses for the lookups.

The easiest way to deal with this is to do additional filtering client side. If the bandwidth impact starts causing issues, partition your data (e.g. group events by month) and do it in multiple phases.



来源:https://stackoverflow.com/questions/25947524/can-i-use-firebases-geofire-with-priority-in-a-single-query

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