This article describes each of the typo tolerance settings.
phnoe
instead of phone
. You can configure the typo tolerance feature for each index.
enabled
phnoe
will no longer return a document containing the word phone
.
In most cases, keeping typo tolerance enabled results in a better search experience. Massive or multilingual datasets may be exceptions, as typo tolerance can cause false-positive matches in these cases.
minWordSizeForTypos
seven
, searching for sevem
or sevan
will match seven
. But tow
won’t match two
as it’s less than 5
characters.
You can override these default settings using the minWordSizeForTypos
object. The code sample below sets the minimum word size for one typo to 4
and the minimum word size for two typos to 10
.
minWordSizeForTypos
object, keep in mind that:
oneTypo
must be greater than or equal to 0 and less than or equal to twoTypos
twoTypos
must be greater than or equal to oneTypo
and less than or equal to 255
0 ≤ oneTypo ≤ twoTypos ≤ 255
.
We recommend keeping the value of oneTypo
between 2
and 8
and the value of twoTypos
between 4
and 14
. If either value is too low, you may get a large number of false-positive results. On the other hand, if both values are set too high, many search queries may not benefit from typo tolerance.
any way
would match documents containing anyway
.For more about typo calculations, see below.disableOnWords
disableOnWords
. disableOnWords
is case insensitive.
Shrek
or shrek
at search time to match documents.
disableOnAttributes
disableOnAttributes
. The code sample below disables typo tolerance for title
:
title
attribute will not tolerate any typos. For example, a search for beautiful
(9 characters) will not match the movie “Biutiful” starring Javier Bardem. With the default settings, this would be a match.
disableOnNumbers
disableOnNumbers
to true
:
By default, typo tolerance on numerical values is turned on. This may lead to false positives, such as a search for 2024
matching documents containing 2025
or 2004
.
When disableOnNumbers
is set to true
, queries with numbers only return exact matches. Besides reducing the number of false positives, disabling typo tolerance on numbers may also improve indexing performance.