我可以在单个查询中使用Firebase的具有优先级的GeoFire吗? [英] Can I use firebase's GeoFire with Priority in a single query?

查看:64
本文介绍了我可以在单个查询中使用Firebase的具有优先级的GeoFire吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用查询来查询我的数据,该查询将返回半径上的所有内容(geofire可以找到该值),而且还可以在日期时间窗口内返回.

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.

目前我将日期时间存储为优先级,因此查询数组以查询2个优先级数字(对应于开始/结束日期时间)之间的数据非常容易.

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).

将我的数据放入GeoFire数组中然后查询以获取半径也很容易.

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

我可以合并那两个吗?以一种简单但又不太hacky的方式吗?

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

欢呼

推荐答案

不包含单个查询.您必须过滤客户端,或在多个阶段中进行查询.

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

这是因为:

  • 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.

这篇关于我可以在单个查询中使用Firebase的具有优先级的GeoFire吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆