API Reference / API Parameters / typoTolerance
Type: string | boolean
Engine default: true
Parameter syntax
'typoTolerance' => true|false|'min'|'strict'

Can be used in these methods:
search, setSettings, searchForFacetValues, generateSecuredApiKey, addApiKey, updateApiKey

About this parameter# A

Controls whether typo tolerance is enabled and how it is applied.

Usage notes#

Options #

true

Typo tolerance is enabled and all records matching queries with or without typos are retrieved (default behavior).

false

Typo tolerance is turned off. Only records matching queries without typos are retrieved.

min

Retrieves records with the smallest number of typos.

strict

Similar to min but keeps the two lowest number of typos and forces the Typo criterion to be first in the ranking formula.

Examples# A

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'
]);
Did you find this page helpful?
PHP v3