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

Can be used in these methods:

About this parameter

Whether to allow typos on numbers (“numeric tokens”) in the query string.

This option can be useful on numbers with special formatting, like serial numbers and zip codes.

Usage notes

When false, typo tolerance is disabled on numbers. For example, the query 304 will match 30450 but not 40450 (which would have been the case with typo tolerance enabled).

Examples

Disable typos on numbers by default

1
2
3
$index->setSettings([
  'allowTyposOnNumericTokens' => false
]);
1
2
3
$results = $index->search('query', [
  'allowTyposOnNumericTokens' => false
]);
Did you find this page helpful?