0

I am using cloud firestore as my database for my angular application. I wanted to implement text based search but the only option I see is using Angolia but I don’t want to use a 3rd party service. Is it possible to implement text search with just the functionality provided by firestore. Even if it returns the object by matching the first characters will work for me it does not have to be a “contain” query.

Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441
zakSyed
  • 1,364
  • 1
  • 13
  • 30
  • See https://stackoverflow.com/questions/46966687/firestore-full-text-search, https://stackoverflow.com/questions/47195122/firestore-comparison-operators-contains-does-not-contain-starts-with, https://stackoverflow.com/questions/46568142/google-firestore-query-on-substring-of-a-property-value-text-search, https://stackoverflow.com/questions/49942242/flutter-search-through-text-data-from-firestore/49942559#49942559, https://stackoverflow.com/questions/48285039/firestore-search-like/48287341#48287341 – Frank van Puffelen Aug 07 '18 at 02:50
  • Specifically the answer from Sam here seems what you want, as it shows how to find documents where the field starts with a certain value: https://stackoverflow.com/a/47916173/209103 – Frank van Puffelen Aug 07 '18 at 02:51

1 Answers1

1

Firestore does not support full text search in any form. That's why the documentation suggests the use of another service.

Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441
  • I was able to get the logic implemented using the following code databaseReference.orderByChild('_searchLastName') .startAt(queryText) .endAt(queryText+"\uf8ff") – zakSyed Aug 07 '18 at 03:06
  • That's searching on a string prefix, not full text search. – Doug Stevenson Aug 07 '18 at 03:09