By default, Compositions inherit the search settings configured on their underlying indices. However, you can customise the search behaviour of a Composition by configuring additional search parameters directly within its definition.
These changes must be made through the Composition API, as they cannot currently be configured in the Algolia Dashboard.
How to configure search parameters
You can add or update search parameters using the putComposition method, either with cURL or your preferred programming language. You can find examples in the API documentation.
Add your desired search parameters to the params section of the Composition definition.
For example, to enable stop-word removal and disable typo tolerance:
{
"behavior": {
"injection": {
"main": {
"source": {
"search": {
"index": "Your Index Name",
"params": {
"removeStopWords": true,
"typoTolerance": false
}
}
}
}
}
}
}This is a simplified example. When updating your Composition, make sure to keep the rest of its existing configuration.
You can find the full request structure in the putComposition API reference.
How do these settings interact with the underlying index?
- By default: Compositions use the search settings configured on their underlying indices.
- When parameters are added: These override any conflicting settings on the underlying index, without changing the index itself.
- When parameters are removed: The Composition returns to using the corresponding settings from the underlying index.
For example, if typo tolerance is enabled on your index but you set typoTolerance: false on the Composition, typo tolerance will be disabled for searches through the Composition. Searches directly against the index will remain unaffected.
How to update or remove parameters
To change or remove existing parameters:
- Retrieve your current Composition configuration using
getComposition. - Edit or remove the relevant parameters in the
paramssection. - Save the updated configuration using
putComposition.
Removing a parameter allows the Composition to default to the underlying index's setting again.
You can also configure search parameters for additional search groups within a Composition using their respective source.search.params sections.