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 very useful on numbers with special formatting, like serial numbers and zip codes searches.

Usage notes:

  • When false, typo tolerance is disabled on numeric tokens. 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 numeric tokens by default

1
2
3
$index->setSettings([
  'allowTyposOnNumericTokens' => false
]);
1
2
3
$results = $index->search('query', [
  'allowTyposOnNumericTokens' => false
]);

Did you find this page helpful?