Improve search in Firestore dataBase

I am trying to make a better search screen from my group collection in Firestore. In order to be able to search for different values I am creating an array within each document where I place values like name, difficulty, style, etc. so it is possible to search for any of those values.

Then, I have created a dataSheet with the group collection query and filtering the query with the “array-contains” taking the value of the dataSlot where I store the text that is placed in the search field. That works fine but I would like to improve it in two aspects:

  • You have to type the value exactly as it is written in the array, so if I write “queen” instead of “Queen”, it won’t show any result. Also the accents would be an obstacle. Would it be possible to make the search so it doesn’t matter if you write with or without accents and capitalized or not letters?

  • I have to type the entire name and it does not show results with partial match. For example, if an array contains “A million dreams”, I have to type exactly those three words, and it doesn’t show any document if I write just “million”. Can it be done like I expect it to work?

Thank you!

Hi, this has been asked couple times but to our knowledge Firebase does not have native support for full text search. You need to implement and use third-party option. Read more from here: https://firebase.google.com/docs/firestore/solutions/search

Thank you for your answer. I am sorry if it is a repeated question. I know it is something that is not supported natively but my question was to know if there is a workaround (script or any other) that allows to solve the issue with the capitalized or not letters or the accents. About the substring search, I have been reading about posible workarounds that are not perfect but it avoids to use third party like Algolia. I created an account in Algolia but I saw that it is necessary to use Cloud Functions and, to use that feature, it is necessary to move to the Blaze plan. I am not comfortable taking that step. I am sure my project won’t exceed the limits of the Blaze Plan because I have a handful of students using it, but I am not an expert and I am afraid to make a mistake that will have consequences in the bill.
Anyway, if there is a solution at least for the first part (capitalized letters and accents) I would use that and some of the workarounds for the search. Thank you!

I don’t think there are any other way to do this than loading the whole collection into Data sheet and somehow filter it in the client side script (probably does not make any sense if you have really large collections)

Here’s how you can filter arrays in client side: https://medium.com/@reactstudio/using-a-script-for-filtering-sorting-list-in-react-studio-ec0a5244719e