Author: Algolia (https://www.algolia.com)
Description: Enable full text search of your Cloud Firestore data with Algolia.
Details: Use this extension to index your Cloud Firestore data to Algolia and keep it synced.
You can then configure your relevance using the Algolia dashboard or API clients. From there, you can use Algolia's front-end libraries to incorporate search components into your Firebase app's UI.
We welcome bug reports and feature requests as well as pull requests in this GitHub repository.
firebase ext:install algolia/firestore-algolia-search --project=<your-project-id>
Learn more about installing extensions in the Firebase Extensions documentation: console, CLI
Use this extension to index your Cloud Firestore data to Algolia and keep it synced. The extension is applied and configured on a Firestore collection or subcollection.
This extension listens for changes on the specified collection. If you add a document, the extension indexes it as a record in Algolia. The extension only indexes the fields defined in the extension configuration and uses the document Id as the Algolia object Id.
Anytime you update a document, the extension propagates the update to the corresponding Algolia record. If you delete a document, the extension removes the corresponding Algolia record.
Before installing this extension, make sure that you've set up:
This extension uses the following Firebase services which may have associated charges:
This extension also uses the following third-party services:
You are responsible for any costs associated with your use of these services.
To install this extension, your Firebase project must be on the Blaze (pay-as-you-go) plan. You will only be charged for the resources you use. Most Firebase services offer a free tier for low-volume use. Learn more about Firebase billing.
You will be billed a small amount (typically less than $0.10) when you install or reconfigure this extension. See Cloud Functions under Firebase Pricing for a detailed explanation.
Cloud Functions Location: Where do you want to deploy the functions created for this extension? You usually want a location close to your database. For help selecting a location, refer to the location selection guide.
Database Id: Enter the database id that contains the collection(s) that you want to monitor? Firebase supports multiple databases in a project. In order to use a non default database, enter the database Id.
Collection Path: What is the path to the Cloud Firestore collection where the extension should monitor for changes?
For subcollection, the syntax is parent_collection/{parentId}/target_collection
. (please note, there is not depublication process on subcollections).
Fields: What document fields should be indexed to provide the best search experience? For more information on which fields to index to Algolia, see the Algolia documentation on records. This can be a comma separated list or left blank to index all fields. For performance reasons, record size is limited. If you're receiving errors that your records are too large, refer to the reducing record size documentation.
Force Data Sync: Are you facing data inconsistent issues possibly due to race conditions? This setting will make sure the function is using the latest data from Firestore by making another read call before processing and sending to Algolia.
Algolia Application ID: What is the Algolia Application Id? This is the Algolia application you want to index your data to. You can find your credentials including application ID on your Algolia dashboard, under the API keys tab.
Algolia API Key: What is your Algolia API key? We recommend creating a new API key with "addObject", "deleteObject", "listIndexes", "deleteIndex", "editSettings", and "settings" permissions. Do not use the Admin API key.
Algolia Index Name: What is the Algolia index name? This is the name of the Algolia index where the records will be persisted. Refer to naming your index for more information.
Alternative Object Id: Are you looking to use another Firestore document property or document path as the Algolia ObjectID?
Specify an alternative Firestore document property to use for the Algolia record Id. Use (path)
if the document path is desired as the Algolia ObjectID. The default is the Firestore document Id.
If you set this property, make sure to clear out the Algolia Index since the ObjectID will be different resulting in duplicate records.
Transform Function Name (experimental): What is the Firebase Cloud Function Name? This is the name of the Firestore Cloud Function for transforming the data before transmitting to Algolia for indexing. This function should be deployed to the same Firebase Project and Location as the Firestore/Algolia extension. Refer to Call functions for your app. Below is an example of a Transform function used for my testing:
import * as functions from "firebase-functions";
const doStuffToData = (payload: any) => {
return {
...payload,
"hello": "world",
};
};
export const helloWorld = functions.https.onCall((payload) => {
const transformedData = doStuffToData(payload);
return transformedData;
});
Note: The Transform Firebase Function should be set up to unauthenticated users at this time.