Firestore搜索-喜欢 [英] Firestore Search - LIKE

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

问题描述

我要搜索嵌套在集合中的文档中的"displayName",或更具体地说,数据如下:

I want to search the "displayName" in documents nested within a collection, or more specifically the data is as follows:

用户-> $ idstring-> displayName

users -> $idstring -> displayName

我已经使用AngularFire提出了以下内容,但是它对我来说仍然不起作用..我需要对照val(用户输入的)的前3个字符检查 displayName 并带回开始的结果有了这一点,我需要一种类似于LIKE的搜索操作,firestore可以做到这一点..到目前为止,它几乎只返回了我的用户集中的所有内容

Ive come up with the following using AngularFire but its still not quite working for me.. I need to check displayName against the first 3 chars of val (user entered) and bring back results that start with that, I need a kind of LIKE search operation to occur, is this possible with firestore.. so far its just returning almost everything in my users collection

this.itemsCollection = this.aft.collection<iUser>('users', ref => ref.orderBy("displayName").startAt(val))

推荐答案

Cloud Firestore文档:

Cloud Firestore不支持本机索引编制或搜索文本文档中的字段.此外,将整个收藏下载到在客户端搜索字段是不切实际的.

Cloud Firestore doesn't support native indexing or search for text fields in documents. Additionally, downloading an entire collection to search for fields client-side isn't practical.

要启用对数据的全文搜索,您需要使用第三方搜索服务,例如 Algolia ElasticSearch .

And to enable full text search of your data, you'd need to use a third-party search service like Algolia or ElasticSearch.

该文档实际上提供了有关如何将Algolia与Firebase集成的指南a>.

The documentation actually provides a guide on how to integrate Algolia with Firebase.

这篇关于Firestore搜索-喜欢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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