# Using the Algolia integration

> This section provides guides on how to configure the Algolia integration and use it with Uniform Canvas.

Source: https://docs.uniform.app/docs/integrations/search/algolia/algolia-integration

The Algolia integration allows you to bind records from an Algolia search index to component parameters.

## Configure the data source

Once you've installed the integration, the next step is to connect Algolia to your Uniform project by **creating a new [data source](../../../guides/composition/glossary#data-source)**.

1. Navigate to **Experience > Data Types**. A data type is an element that can be retrieved from a data source, so the first step is to identify a data source.
2. Create a new data source by clicking the **Add data type** button and select the "Create new" option under the Algolia label.

   ![Where to create a new data type from the available data sources.](https://docs.uniform.app/images/integrations/search/algolia/data-binding/create-new-data-source.png)
3. Provide details specific to the Algolia application you are connecting to:

   | Field | Description |
   | --- | --- |
   | Application ID |  |
   | API Key |  |
4. Name your **data source**. Choose a name that helps to inform your editorial users where the content is coming from. The name of the Algolia application is a good option here.

> **Use multiple applications:**
>
> You may have more than one application that you are using with Algolia, perhaps to separate content used across different sites or different brands.
>
> By repeating the preceding steps, you can support any number of Algolia applications within a single Uniform project, allowing you to bring content together from across your Algolia applications.

## Algolia data types

Before you start connecting Algolia data to your Uniform compositions, it's important to first create some **[data types](../../../guides/composition/glossary#data-type)**. Data types define which types of Algolia data editors can use. This could be simple, like allowing an editor to select a single "hero" entity, or more perhaps a more complex query such as "the five latest news article entries."

Go to **Experience > Data Types** and click the **Add data type** button from below the Algolia data source that you set-up earlier.

![Add a data type after selecting the data source.](https://docs.uniform.app/images/integrations/search/algolia/data-binding/add-data-type.png)

Next, you will want to select and configure an archetype from the options below:

### Archetype: Recommend

The recommend selector is useful for returning a records that are recommended based on the record selected by the editor.

![The screen where you select the record to get recommendations for.](https://docs.uniform.app/images/integrations/search/algolia/data-binding/recommend-archetype.png)

### Archetype: Query

The query archetype will always return a list of records, up to the limit set by the editor in Uniform. This can be useful for dynamic queries where the most up-to-date information is needed, such as a "latest content" section.

![Retrive records by a query.](https://docs.uniform.app/images/integrations/search/algolia/data-binding/query-archetype.png)

### Archetype: Single record

The single record archetype will always return a single record from Algolia, based on a selection by the editor in Uniform. This is useful for non-list elements that render as an independent item, such as a single "hero" record or "article" record. It can accept a variable from a dynamic token (such as a slug) and retrieve the corresponding record.

![Select a single record from available data.](https://docs.uniform.app/images/integrations/search/algolia/data-binding/single-record-archetype.png)

### Archetype: Multiple records

The multiple records archetype lets an editor hand pick multiple records to render as a list. This is useful when a small selection of specific records is required, such as in a "featured articles" carousel.

![](https://docs.uniform.app/images/integrations/search/algolia/data-binding/multiple-records-archetype.png)

## Multi-Language Support

Algolia integration supports the utilization of language-specific indices by using a dynamic index name based on the current locale.

You can define **Dynamic Index Name** on the Data Type level.

![Configure a dynamic index name for localized indexes](https://docs.uniform.app/images/integrations/search/algolia/data-binding/algolia-dynamic-index-name.png)

> **Info:**
>
> When the locale identifier in an Algolia index does not match a locale defined in your Uniform project, you can resolve the mismatch by configuring the [Locale mapping](https://docs.uniform.app/docs/guides/composition/connect-external-data/data-modeling#locale-mapping-for-data-sources) in the Algolia data source settings.

## Connect data to compositions, components and patterns

Once you have configured your data types, they can be used to bind parameters on compositions, components and compositions to Algolia records.
