为什么Firestore无法与多个字段范围过滤器一起使用? [英] Why does firestore not work with multiple field range filters?

查看:34
本文介绍了为什么Firestore无法与多个字段范围过滤器一起使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

firestore为什么不能与多个字段范围过滤器一起使用?

Why does firestore not work with multiple field range filters?

我也想知道为什么我不能进行全文搜索.

I also want to know why I can not do full text search.

算法有原因吗?

我想知道原因.

推荐答案

Firestore具有非常独特的性能保证:检索数据所需的时间仅取决于您检索的数据量,而不取决于您检索的数据量它来自.因此,无论集合中有成千,一百万或十亿个文档,检索其中十个文档都将花费相同的时间.

Firestore has a quite unique performance guarantee: the time it takes to retrieve data only depends on the amount of data you retrieve, not on the amount of data you retrieve it from. So no matter if there are a thousand, a million, or a billion documents in a collection, retrieving ten of those documents will always take the same amount of time.

为了能够保证此性能,Firestore具有一组有限的(主要是查询)功能.例如:Firestore仅支持可以跳转到索引中正确起点的查询,并从该起点一直流到查询结束的结果.这就阻止了它支持诸如此类的东西:

In order to be able to guarantee this performance, Firestore has a limited set of (mostly query) capabilities. For example: Firestore only supports queries for which it can jump to the correct starting point in an index, and stream results from that starting point until the end of the query. This precludes it from supporting things like:

  • OR查询,因为那些查询将需要跳过索引,这将无法保证性能.请注意,正在努力支持可能的IN查询的子集,以便您可以查询诸如给我提供泰国或意大利美食的所有餐厅"之类的信息.
  • 查询文本的子字符串.Firestore仅支持所谓的前缀查询,因此值开头的是子字符串,而值包含的是子字符串.因此,您可以搜索给我所有以'zla'开头的名称",而不是给我所有包含'lat'的名称".
  • 在多个范围内进行查询,因为它们也可能无法保证性能.
  • OR queries, since those would require skipping through the index, which would make it impossible to guarantee the performance. Note that work is under way to support a subset of possible IN queries, so that you could query for something like "give me all restaurants that serve either Thai or Italian food".
  • queries for substring of text. Firestore only supports so-called prefix queries, so where the value starts with a substring, but not where the value contains a substring. So you could search for "give me all names that start with 'zla'", but not for "give me all names that contain 'lat'".
  • querying on multiple ranges, since those too might make it impossible to guarantee the performance.

有关此内容的另一个很好的解释,请参见了解Cloud Firestore 有关查询的信息

For another good explanation of this, see the Getting to know Cloud Firestore episode on queries.

这篇关于为什么Firestore无法与多个字段范围过滤器一起使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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