0

Assuming I have a list of data I would like to store with Firestore database, and search it later.

What would be the best way to store the data and query it to get the best performance?

My data is a list of names (containing a lot of names).

["Bob", "Rob", Robert, Robe, ...]

Assuming I search for names containing "obe" I should get the response with the names "Robert" and "Robe".

Note that I want to get the same result for the term "ObE" also.

Haim763
  • 1,514
  • 2
  • 10
  • 14
  • Firestore only supports prefix matches in its queries, so searching for strings starting with a certain substring, e.g. all names starting with "Ro". Firestore does not support other types of string searches, such as the "contains" query you are looking for. Most developers use a 3rd party search service for that. See the documentation for more on this https://firebase.google.com/docs/firestore/solutions/search – Frank van Puffelen Dec 07 '18 at 14:01
  • What about the best way to store the data? Array is not that efficient as I see it. The issue is that you cannot search documents, only collections.. So how should I do it? – Haim763 Dec 08 '18 at 15:27

0 Answers0