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 numeric typos in the query.

  • Enable numeric typo tolerance to help broaden your search and help users find numbers in a query even if they don’t remember every digit.
  • Turn numeric typo tolerance off if you only want users to find matches for the exact number they entered. This can help reduce false negative results when searching for things like zip codes or similar number sequences.

For example, if a user searches for “304”:

allowTyposOnNumericTokens User finds
On (true) 304, 404, 340
Off (`false’) 304

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?