Flutter:在Firestore中搜索文本数据 [英] Flutter: Search through text data from Firestore

查看:89
本文介绍了Flutter:在Firestore中搜索文本数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的Flutter应用中实现搜索功能。文本数据存储在Firestore中。

I want to implement a search feature in my Flutter app. The text data is stored in Firestore.

现在,我正在考虑一个不切实际的解决方案:下载整个集合(纯文本),然后以某种方式使用Dart代码进行搜索。

Now I'm considering an impractical solution: downloading the whole collection (which is a plain text) and then somehow search through it with Dart code.

在Flutter / Firestore中有更好的搜索方法吗?我可以使用云功能来做到这一点吗?如果没有更好的方法,如何在Flutter中使用Dart搜索内容?

Is there a better way to do search in Flutter/Firestore? Can I use Cloud Functions to do that? And if there's no better way, how to search through content with Dart in Flutter?

推荐答案

Cloud Firestore当前唯一可能的文本搜索类型是所谓的前缀搜索。这允许以某些值开头的发现字符串,例如 Dark * ,或以一定范围开头的字符串,例如 A *到B

The only type of text search that is currently possible on Cloud Firestore is a so-called prefix search. This allows findings strings that start with certain values, like Dark*, or strings starting with a certain range, like A* to B.

当前无法搜索包含某个字符串或更复杂操作的值。

There is currently no way to search for values that contain a certain string, or more complex operations.

这适用于Firestore,无论您如何访问它。因此,它适用于Web,iOS,Android,Flutter,REST和Cloud Functions所依赖的Admin SDK。

This applies to Firestore no matter how you access it. So it applies to Web, iOS, Android, Flutter, REST, and the Admin SDKs that Cloud Functions relies on.

将全文搜索添加到该应用程序基于Cloud Firestore构建,因此可以集成第三方文本搜索引擎,例如Algolia或ElasticSearch。有关更多信息,请参见 Firebase文档

The common way to add full-text search to an app built on Cloud Firestore it so integrate a third-party text search engine such as Algolia or ElasticSearch. For more on this, see the Firebase documentation.

这篇关于Flutter:在Firestore中搜索文本数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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