allowTyposOnNumericTokens

scope settings search
type boolean
default true
description

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

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).

This option can be very useful on serial numbers and zip codes searches.

Examples

Disable typos on numeric tokens by default

<?php
$index->setSettings([
  'allowTyposOnNumericTokens' => false
]);
index.set_settings({
  allowTyposOnNumericTokens: false
})
index.setSettings({
  allowTyposOnNumericTokens: false
});
index.set_settings({
    'allowTyposOnNumericTokens': False
})
index.setSettings([
    "allowTyposOnNumericTokens": false
])
index.setSettings(new JSONObject().put("allowTyposOnNumericTokens", false));
index.SetSettings(
  JObject.Parse(@"{""allowTyposOnNumericTokens"":""false""}")
);
index.setSettings(
  new IndexSettings().setAllowTyposOnNumericTokens(false)
);
res, err := index.SetSettings(algoliasearch.Map{
    "allowTyposOnNumericTokens": false,
})
client.execute {
  changeSettings of "myIndex" `with` IndexSettings(
    allowTyposOnNumericTokens = Some(false)
  )
}
<?php
$results = $index->search('query', [
  'allowTyposOnNumericTokens' => false
]);
results = index.search('query', {
  allowTyposOnNumericTokens: false
})
index.search({
  query: 'query',
  allowTyposOnNumericTokens: false
}).then(res => {
  // console.log(res);
});
results = index.search('query', {
    'allowTyposOnNumericTokens': False
})
let query = Query(query: "query")
query.allowTyposOnNumericTokens = false

index.search(query, completionHandler: { (res, error) in
    print(res)
})
index.search(new Query("query").setAllowTyposOnNumericTokens(false));
index.search(
  new Query("").EnableTyposOnNumericTokens(false)
)
index.search(
  new Query("").setAllowTyposOnNumericTokens(false)
);
res, err := index.Search("query", algoliasearch.Map{
    "allowTyposOnNumericTokens": false,
})
client.execute {
  search into "myIndex" query Query(
    query = Some("query"),
    allowTyposOnNumericTokens = Some(false)
  )
}
Php small white
PHP
Ruby small white
Ruby
Javascript small white
JavaScript
Python small white
Python
Swift small white
iOS
Android small white
Android
Csharp small white
C#
Java small white
Java
Go small white
Go
Scala small white
Scala
Php small white
PHP
Ruby small white
Ruby
Javascript small white
JavaScript
Python small white
Python
Swift small white
iOS
Android small white
Android
Csharp small white
C#
Java small white
Java
Go small white
Go
Scala small white
Scala