Android Tech Lead at CodeStringers·

I want to develop a mobile app with Cloud Firestore as backend. It's good until I realize need to implement FullTextSearch, and Firestore doesn't support it natively. Although they advise to use Algolia but at this time I'm not willing to pay for it.

Therefore, I'm thinking about using the built-in tool from Google Cloud. Since this app is online-only, the offline & sync are not a top priority, so how about use Google Cloud SQL? Or, do you recommend any stack for me? Thanks for your advice.

5 upvotes·32.7K views
Replies (2)
Principal Software Engineer at Tophatter·

In the early days, people would set up their own Elastic Search clusters and have troubles maintaining it, keeping it secure, also this required a lot of manual work to get the data in, keep it current, query it... etc. A couple of years ago AWS came up with AWS Elastic Search Service, which reduced some of this overhead. My previous teams and I went through all of these different stages, and ultimately, discovering Algolia a couple of years ago, solved so many of our issues, kept the cost low, reduced dramatically Implementation therefore GTM timelines, and freed up so much of our engineering bandwidth. They have SDKs for most common languages and platforms, and you can achieve a complete solution in just a matter of hours if not minute. Value your own/your team's engineering time. Factor that in when comparing costs. There should also be entry-level tiers you can get a proof of concept rolled out with.

How Algolia Works | Getting Started | Guide | Algolia Documentation (
7 upvotes·815 views

Since SQL Databases have a support for Full Text Search inbuilt into them, they are a better choice. With Firestore you can implement a full text search but it will still cost more reads than it would have otherwise, and also you'll need to enter and index the data in a particular way, So in this approach you can use firebase cloud functions to tokenise and then hash your input text while choosing a linear hash function h(x) that satisfies the following - if x < y < z then h(x) < h (y) < h(z). For tokenisation you can choose some lightweight NLP Libraries in order to keep the cold start time of your function low that can strip unnecessary words from your sentence. Then you can run a query with less than and greater than operator in Firestore. While storing your data also, you'll have to make sure that you hash the text before storing it, and store the plain text also as if you change the plain text the hashed value will also change.

6 upvotes·578 views
Avatar of Triet Bui Minh

Triet Bui Minh

Android Tech Lead at CodeStringers