🎉 Try the public beta of the new docs site at algolia.com/doc-beta! 🎉
API Reference / API Parameters / typoTolerance
Type: string | boolean
Engine default: true
Parameter syntax
'typoTolerance' => true|false|'min'|'strict'

Can be used in these methods:

About this parameter

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

Set default typo tolerance mode

1
2
3
4
5
6
$index->setSettings([
  'typoTolerance' => true
  // 'typoTolerance' => false
  // 'typoTolerance' => 'min'
  // 'typoTolerance' => 'strict'
]);
1
2
3
4
5
6
$results = $index->search('query', [
  'typoTolerance' => false
  // 'typoTolerance' => true
  // 'typoTolerance' => 'min'
  // 'typoTolerance' => 'strict'
]);
Did you find this page helpful?