Overriding index settings
The Magento extension is responsible for writing various configuration settings to your Algolia indices.
What that means is that it is possible for Magento to overwrite changes that you make directly in the Algolia dashboard. It is good to understand which settings are impacted by this behavior.
Which settings are managed by Magento?
For each entity (data type) and store managed in Magento there is typically at least one associated index.
Magento manages these configurations for the following entities:
searchableAttributes
customRanking
unretrievableAttributes
attributesForFaceting
maxValuesPerFacet
removeWordsIfNoResults
searchableAttributes
:unordered(slug)
,unordered(name)
,unordered(content)
attributesToSnippet
:content:7
searchableAttributes
:unordered(query)
customRanking
:desc(popularity)
,desc(number_of_results)
typoTolerance
:false
attributesToRetrieve
:query
removeWordsIfNoResults
:lastWords
searchableAttributes
:unordered(value)
Any settings that are not in this list can be managed independently.
Managing settings in the Algolia dashboard
If a setting is not explicitly managed by Magento then it is possible to configure it in the Algolia Dashboard.
Keep in mind that some settings have default values.
Example
The index setting typoTolerance
is set to true
by default on any
new index unless you explicitly set it to false
.
Since the Magento extension doesn’t manage this setting for product indices, it’s initially set to true
.
However, the value of typoTolerance
for product indices can be configured from the Algolia dashboard.
Subsequent indexing operations from the Magento extension shouldn’t alter this value unless you explicitly configure Magento to do so.
Customizing Magento index settings
You can customize how Magento writes index settings to Algolia:
Advanced Algolia indices settings
To have Magento enforce an index setting value other than the default, specify that value in the Magento admin panel under:
Stores → Configuration → Algolia Search → Advanced Algolia indices settings
This configuration page features a section for each entity that Magento manages.
Specify your desired configuration using JSON syntax.
Example
To specify an alternate value for the typoTolerance
setting, add the following JSON configuration under “Products’ indices settings”:
1
{ "typoTolerance": false }
Backend events
For more programmatic control over how the Magento extension writes settings to the Algolia indices, create an observer class to handle one or more entity-specific index setting events.