【问题标题】:Text search on firestore document field [duplicate]Firestore文档字段上的文本搜索[重复]
【发布时间】:2025-12-24 00:25:15
【问题描述】:

我正在使用 Cloud Firestore 作为我的 Angular 应用程序的数据库。我想实现基于文本的搜索,但我看到的唯一选择是使用 Angolia,但我不想使用 3rd 方服务。是否可以仅使用 firestore 提供的功能来实现文本搜索。即使它通过匹配第一个字符来返回对象也对我有用,它不一定是“包含”查询。

【问题讨论】:

标签: firebase google-cloud-firestore


【解决方案1】:

Firestore 不支持任何形式的全文搜索。这就是文档建议使用其他服务的原因。

【讨论】:

  • 我能够使用以下代码实现逻辑 databaseReference.orderByChild('_searchLastName') .startAt(queryText) .endAt(queryText+"\uf8ff")
  • 搜索的是字符串前缀,不是全文搜索。