One of the nicest ways to improve a users experience within your app is to provide full text search across a variety of lists or collections.

Algolia realtime search in action in an equipment management app using Firebase and Firestore

In this tutorial, I will run through how to implement realtime full-text search with Algolia, Firebase functions and Firestore (Firebase’s new realtime database).

You might be thinking, hang on — you just said Firestore is a realtime database — why would I need another realtime database to handle full-text search. Good question! The answer is Firestore is great at updating changes to a collection as they happen as it sets up listeners on whatever collection or single object you like. Firestore however isn’t designed to provide super-fast pre-indexed search results using free-text input. That’s where Algolia shines though.

Algolia is search-as-a-service. In short — it gives your app Google-quick full text search results. Anything you add to Algolia can be searched (even with spelling mistakes like I showed in the video above).

Overall, the steps to implement Algolia search are:

Create an Algolia account algolia.com Create an index in Algolia (this just means what is the name of the database you would like to search that already exists in your app — in my Firestore database I had an “equipment” collection so I created an “equipment” index in Algolia. Create a firebase function that listens for creates and updates in your collection and copy them to Algolia Add some items to a Firestore collection to test it out Call Algolia on the front end of your app to display the search results

Let’s go through each of these steps shall we?

Step 1: Create an Algolia account

Not much else to say here just go to algolia.com and create a free account

Step 2: Create an index in Algolia

Once you’ve created your account, click Indices on the left hand panel then click “New Index”