Firebase Full Text Search 🔎

Cloud Firestore does not natively support indexing or searching text fields in documents. To enable full-text search functionality in your…

Firebase Full Text Search 🔎

Cloud Firestore does not natively support indexing or searching text fields in documents. To enable full-text search functionality in your Firebase project, we recommend integrating with a third-party search integrations like Algolia(opens in a new tab), Elastic(opens in a new tab), or Typesense(opens in a new tab), which provide powerful and efficient search capabilities.

The integration involves two main steps:

  1. Installing the Firebase Extension

Choose a third-party search service that suits your requirements, such as Algolia, Elastic, or Typesense. Each service may have its own extension for Firebase.

These Firebase extensions help in indexing your data and syncing it with the third-party search service everytime a CRUD operation is performed on your Firebase data. This helps reduce the cost of indexing and syncing your data.

đź“š

Get your Firebase Extensions here!

Firebase Extensions are pre-packaged solutions that you can install with a single click. Click on the links below to install the Firebase Extensions for your preferred search service:

  1. Node for Performing a Full-Text Search on the Search Index

This node allows you to execute full-text search queries on the data stored in the respective search index.

Let’s take a look at how to implement full-text search on your Firebase data. For this example we’ll be using Algolia.

Set up Algolia

  • Go to Algolia’s website(opens in a new tab) and either log in to your existing Algolia account or create a new one if you don’t have an account yet.
  • Click on “New Application” and provide a name for your application. Choose an appropriate subscription plan and select a region for your data center.
  • After creating the application, navigate to the “Indices” section. Create a new index and give it a name. You can keep the index name the same as your Firestore collection name for simplicity.

Get Algolia Keys

To perform the Full Text Search on your Firebase data, we will be using Algolia’s API. To use the API, we need to get the API Key, App ID, and Index Name from Algolia’s Dashboard.

Install the Algolia Firebase Extension

To sync your Firebase collection with Algolia’s index, we need to install the Algolia Firebase Extension(opens in a new tab).

  • Click on the “Install in Firebase” button. This will open the Firebase Console in a new tab.
  • Select the Firebase project in which you want to install the extension. If you don’t have a Firebase project, you can create a new one.
  • Proceed with the installation.You would be required to add your Algolia API Key, App ID, and Index Name to the node, described in the previous section. Click on the “Install” button.
  • This would take approximately 3–5 minutes to install on your Firebase project.

To perform a full-text search on the Algolia index, we need to use the “Algolia Full Text Search” Node from the Node Explorer. You can find this node under the “Algolia” category. This node performs a full text search on an Algolia index and returns a JSON object or an array of JSON objects.

  • You would be required to add your Algolia API Key, App ID, and Index Name to the node, described in the previous section.

âś…

Store your keys in the Secret Manager The API Key is a sensitive piece of information and should not be shared publicly. Make sure you keep your API Key secure and do not share it with anyone. Learn how to store your API Keys as secrets here.

  • The Query input parameter is the search query that you want to execute on the Algolia index.

You can add this node to your workflow to perform a full-text search on the Algolia index with your Firebase data.

This is how you can perform a full-text search on your Firebase data using Algolia. You can use the same steps to perform a full-text search on your Firebase data using Elastic or Typesense.

You can find the Full Text Search Nodes for each of these integrations under their respective categories in the Node Explorer.