DX Engine for Algolia
The Algolia - Search Component Type invokes the client.multipleQueries()
method in Algolia’s JavaScript SDK to search across one or more indices and/or facets with a single method call.
Within the Algolia - Search Component definition, you can configure multiple queries to process concurrently. See: https://www.algolia.com/doc/api-reference/api-methods/multiple-queries/?client=javascript#method-param-query-object
Connection Configuration
Before using the Algolia - Search Component Type, create and configure an Algolia Connection.
To create the Algolia Connection in the DX Engine UI:
- In the top navigation, click Settings, and then click Connections. The Manage Connections page appears.
- Click Add Connection. The Create Connection wizard appears.
- For Connection Code, enter a unique identifier for the Algolia Connection.
- For Connection Name, enter a friendly name for the Algolia Connection.
- Optionally, enter a Connection Description.
- For Connector, select Algolia.
- For API Key, enter your Algolia API key. You may choose to create a Secret to store this value.
- For Application ID, enter your Algolia application ID.
- Click Submit.
Component Configuration
To create an Algolia - Search Component in the DX Engine UI:
- In the top navigation, click Manage Experiences, and then click Components. The Manage Components page appears.
- Click Add Component. The Create Component wizard appears.
- For Component Code, enter a unique identifier for the Algolia - Search Component.
- For Component Name, enter a friendly name for the Algolia - Search Component.
- Optionally, enter a Component Description.
- Select the No Rules checkbox.
- For Component Type, select Algolia - Search.
- Click Submit.
To configure the Algolia - Search Component, in the Manage Components page:
- Next to the Algolia - Search Component, click the Edit button. The Edit Component wizard appears.
- For Connection, select the Algolia Connection created previously.
- Enter query definitions.
You may define one or more queries, either using the form or through a JS Expression in the Queries Override field. If you define the Queries Override field, any other query definitions will be ignored.
To define queries using the form, for each query, enter the following values:
Parameter Name | Parameter Property | Description |
---|---|---|
Index Name | indexName | The name of the Algolia index. |
Type | type | The type of the query. See: https://www.algolia.com/doc/api-reference/api-methods/multiple-queries/?client=javascript#method-param-type |
Query | query | The value for which to query. You may use a Context Field to pass this value through the orchestration flow to this Algolia - Search Component. See: Context |
Params | params | Algolia search parameters. See: https://www.algolia.com/doc/api-reference/api-methods/multiple-queries/?client=javascript#method-param-query-object |
To define queries programmatically, use the Queries Override field and enter a JS Expression that evaluates to an array of query definitions. For example:
_.identity([
{
'indexName': 'my-index',
'query': `${contextField('searchTerm') ? contextField('searchTerm') : ''}`,
'params': {
'facets': ['*'],
'attributesToRetrieve': ['Title', "ImageUrl"],
'hitsPerPage': 5
}
}
])
- Enter the Strategy and Request Options as follows:
Parameter Name | Parameter Property | Description |
---|---|---|
Strategy | strategy | The strategy for the query. See: https://www.algolia.com/doc/api-reference/api-methods/multiple-queries/?client=javascript#method-param-strategy |
Request Options | requestOptions | Request options for the query. See: https://www.algolia.com/doc/api-reference/api-methods/multiple-queries/?client=javascript#method-param-requestoptions |
- Click Submit.