0

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

users -> $idstring -> displayName

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))
Kravitz
  • 2,769
  • 6
  • 26
  • 53

1 Answers1

1

As mentioned on the Cloud Firestore Documentation:

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.

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

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

  • 1
    Yeah I was hoping to avoid introducing another 3rd party service into my app.. I guess Ill filter the users by geographic location then pull down that entire list or something manageable like that – Kravitz Jan 16 '18 at 18:35
  • If this answer was useful, click the upvote button to the left of it. If it answered your question, click the checkmark to accept it. That way others know that you've been (sufficiently) helped. – Rosário Pereira Fernandes Feb 06 '18 at 15:26