Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Looking for a cheap way to add full-text search to firestore

Here is what I want to do

Lets assume I have an Angular Dart application with a firestore backend that e.g. stores books. Each book has a title, a summary and a published date. Now I want to add a fulltext search with pagination to my app. Since firestore does not have fulltext search I need to add this myself if I want to have e.g the first 10 books containing "cat" ordered by published date.

Failed attempts

My first idea was to use the Elasticsearch docker container and deploy that on Google Cloud. Initially I tried to do this on Google Kubernetes but besides being a bit over-complicated it seems to cost way too much. Next I looked into Google App Engine with docker but this still seems to come up to 60$ per month since the Elasticsearch container needs 4GB ram.

So now I am stuck what to do. Look into Google Compute Engine and running docker inside a VM. I wonder how much that costs? Or maybe write something to interface with Google Cloud Search from a Google App instance exposing the results somehow?

All of this seems to be way to complicated for what I want to do. I might have like a thousand books to index which comes up to maybe 10MB in data and only a few thousand queries per month.

like image 945
Fabian Avatar asked May 12 '18 14:05

Fabian


People also ask

Is Google firestore expensive?

Cloud Firestore includes a no-cost tier to help you get started at no cost. After you exceed the usage and storage quotas for the no-cost tier, you're charged for the database operations you perform, the data you store, and the network bandwidth you use.

How do I get firestore to fetch data?

Reading data from Firestore There are two ways for retrieving data, which is stored in Cloud Firestore. Calling a method to get the data. Setting a listener for receiving data changes events. We send an initial snapshot of the data, and then another snapshot is sent when the document changes.


1 Answers

Algolia seems like the perfect/best solution for your use case. It is SO easy to setup and is lightning fast. Have a look at their docs and pricing and test it out yourself. There’s also a sample firestore function that may interest you.

like image 176
Vincent Avatar answered Oct 26 '22 11:10

Vincent