disableExactOnAttributes
[]
'disableExactOnAttributes' => [ 'attribute', ... ]
Can be used in these methods:
search,
setSettings,
browseObjects,
searchForFacetValues,
generateSecuredApiKey,
addApiKey,
updateApiKey
search,
set_settings,
browse_objects,
search_for_facet_values,
generate_secured_api_key,
add_api_key,
update_api_key
search,
setSettings,
browseObjects,
searchForFacetValues,
generateSecuredApiKey,
addApiKey,
updateApiKey
search,
set_settings,
browse_objects,
search_for_facet_values,
generate_secured_api_key,
add_api_key,
update_api_key
search,
setSettings,
browse,
searchForFacetValues,
generateSecuredApiKey,
addAPIKey,
updateAPIKey
search,
setSettings,
browseObjects,
searchForFacetValues,
generateSecuredApiKey,
addApiKey,
updateApiKey
Search,
SetSettings,
Browse,
SearchForFacetValues,
GenerateSecuredApiKey,
AddApiKey,
UpdateApiKey
Search,
setSettings,
browse,
searchForFacetValues,
generateSecuredApiKey,
addApiKey,
updateApiKey
Search,
SetSettings,
BrowseObjects,
SearchForFacetValues,
GenerateSecuredAPIKey,
AddAPIKey,
UpdateAPIKey
search,
setSettings,
browse index,
search into facet values,
generateSecuredApiKey,
add key,
update key
About this parameter
List of attributes for which you want to turn off the exact ranking criterion.
Because the engine’s exact ranking criterion finds variations of the search terms, users might get too many irrelevant results when searching in long attributes like product descriptions.
Enabling `disableExactOnAttributes:
- Prioritizes exact matches in longer attributes
- Reduces the number of false positives
- Doesn’t reduce relevance for other attributes.
On the other hand, when searching for something precise, like keywords, it’s usually better not to enable this parameter. This is because exact matches are more likely between queries and these attributes.
Usage notes
- The
searchableAttributes
setting must not be empty or null - The list must be a subset of the
searchableAttributes
index setting.
There’s no limit to the number of attributes in the list, but having many attributes slows down calls to getSettings
. This can make the Algolia dashboard slower and less responsive.
Examples
Turn off the exact ranking criterion for some attributes by default
1
2
3
4
5
$index->setSettings([
'disableExactOnAttributes' => [
'description',
]
]);
Turn off the exact ranking criterion for some attributes for the current search
1
2
3
4
5
$results = $index->search('query', [
'disableExactOnAttributes' => [
'description'
]
]);