问题
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