1
votes

I have to implement full-text search in my flutter app, which uses Cloud Firestore as backend. A search will scan documents in a collection and see if any of them contains the search string. Firestore doesn't natively supports full-text search and suggests using third-party search service, Algolia. The problem - it is very expensive.

Can I use bigquery for this function? I am already streaming data into bigquery via firestore. So all the collections are available in bigquery.

How do I perform bigquery's "SELECT" query directly from a flutter app? What are the cons, if any for this approach and are there any alternatives.

1
"Are there any alternatives?" The Firestore documentation recommends a dedicated full-text search engine, such as Algolia: firebase.google.com/docs/firestore/solutions/searchFrank van Puffelen
As mentioned in the question, the official documentation suggests only Algolia, which is charges $1 for indexing and searching 1000 documents. We are looking for a more economical solution, and bigquery's pricing suits us. It is also a part of Google's cloud infra.jerrymouse

1 Answers

1
votes

Can I use bigquery for this function?

You'll have the best results if you use the right tool for the job. If you want ad-hoc querying across huge data sets, I'd recommend BigQuery. If you want to perform a full-text search, I recommend using a dedicated full-text search engine.

How do I perform bigquery's "SELECT" query directly from a flutter app?

Google Cloud products come with SDKs that are meant to be used from trusted environments only. There is no direct SDK for accessing BigQuery directly from your Flutter application code, or any other direct clients that I know of.

So you'll have to wrap the server-side code in a custom API that you then expose to your Flutter app. Typically you'll do this in something like Cloud Functions or Cloud Run.