Skip to main content

Algolia index

The Algolia Extension is an extension for syncing data fields to an Algolia Index.

Algolia Extension

GCP Secret Manager Setup

Navigate to the Google Cloud Secret Manager and create a new secret with the following details:

Secret Name: algolia

Secret Value:

{
"appId": "YOUR_ALGOLIA_APP_ID",
"adminKey": "YOUR_ALGOLIA_ADMIN_KEY",
"searchKey": "YOUR_ALGOLIA_SEARCH_KEY"
}

Working

Algolia Index

The DocSync extension accepts three properties:

  • fieldsToSync: It is an array of strings representing the fields in row that should be synced to the Algolia Index.

  • row: It is an object representing a row of data. It is the data that is being synced.

  • index: It is a string representing the name of the Algolia Index to which the data is being synced. You can create a new index in the Algolia dashboard.

  • objectID: It is a string representing the objectID of the Algolia Index to which the data is being synced.

Working based on trigger types

The extension will sync and update the Algolia Index based on its trigger type, which is defined in the extension's configuration modal.

Algolia Extension Modal

Usage

const extensionBody: AlgoliaIndexBody = async ({ row, db, change, ref }) => {
// you can modify the data passed in the row before syncing

return {
// a list of string of column names that would be synced to algolia
fieldsToSync: ["field1", "field2"],
// object of data to sync, usually the row itself
row: row,
// algolia index to sync to
index: "algoliaIndex1",
// algolia object ID, ref.id is one possible choice
objectID: ref.id,
};
};