0

I have a collection of salons, now there's an array of keywords inside a salon. for example

SalonModel {
String salonName;
String salonAddress;
List<String> keywords; (eg: ["hairdresser","covid-19","free coffee"])
}

Now if i type hair inside search field i want to somehow query in firebase to match all the tags with hair in it ( for eg "hairdresser" matches with "hair" ) and return those salons doc which have hair keyword in it. Is there any approach to do that or any alternative way ?

3
  • 1
    I think this article, might help. Isn't it?
    – Alex Mamo
    Nov 16, 2021 at 10:49
  • Thanks that helps, Only the last thing i want to ask that : can we do a "startsWith" query in a list of strings/keywords stored inside a doc ? Nov 17, 2021 at 0:22
  • No, you cannot do that with an array.
    – Alex Mamo
    Nov 17, 2021 at 7:32

1 Answer 1

3

Supposing that you've got a well-designed and working search bar in your Flutter front end application, you can:

  1. Query Firebase with simple queries, such as these;
  2. Implement a Backend middleware that handles a simple search engine, but that's another toppic.

The point here is that, to my knowledge, Firestore is meant to be a Database, whereas a Search Engine is just another story.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.