typoTolerance
true
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,
GenerateSecuredApiKeys,
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
Controls whether typo tolerance is enabled and how it is applied.
Usage notes
- Use
getRankingInfoto retrieve the number of typos for each result. - Algolia usually doesn’t return records with more than two typos. You might see records with three typos, if the first letter of a word is mistyped.
- If
typoToleranceistrue,min, orstrict, the engine enables splitting and concatenation. - If
typoToleranceisminorstrict, a rule’s promoted hits might not appear if they contain more typos than the top results. - When used with the
browsemethod,minandstrictare treated the same astrue.
Options
|
Typo tolerance is enabled and all records matching queries with or without typos are retrieved (default behavior). |
|
Typo tolerance is turned off. Only records matching queries without typos are retrieved. |
|
Retrieves records with the smallest number of typos. |
|
Similar to |
Examples
Set default typo tolerance mode
1
2
3
4
5
6
$index->setSettings([
'typoTolerance' => true
// 'typoTolerance' => false
// 'typoTolerance' => 'min'
// 'typoTolerance' => 'strict'
]);
Override default typo tolerance mode for the current search
1
2
3
4
5
6
$results = $index->search('query', [
'typoTolerance' => false
// 'typoTolerance' => true
// 'typoTolerance' => 'min'
// 'typoTolerance' => 'strict'
]);