diff --git a/.code-samples.meilisearch.yaml b/.code-samples.meilisearch.yaml index fe0f564e0..29ba3c97e 100644 --- a/.code-samples.meilisearch.yaml +++ b/.code-samples.meilisearch.yaml @@ -831,6 +831,13 @@ typo_tolerance_guide_4: |- "twoTypos": 10 } }' +typo_tolerance_guide_5: |- + curl \ + -X PATCH 'MEILISEARCH_URL/indexes/movies/settings/typo-tolerance' \ + -H 'Content-Type: application/json' \ + --data-binary '{ + "disableOnNumbers": true + }' updating_guide_check_version_new_authorization_header: |- curl \ -X GET 'http:///version' \ diff --git a/learn/relevancy/typo_tolerance_settings.mdx b/learn/relevancy/typo_tolerance_settings.mdx index a7e39f81f..7062f9e0d 100644 --- a/learn/relevancy/typo_tolerance_settings.mdx +++ b/learn/relevancy/typo_tolerance_settings.mdx @@ -65,3 +65,13 @@ You can disable typo tolerance for a specific [document attribute](/learn/gettin With the above settings, matches in the `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` + +By default, typo tolerance on numerical values is turned on. This may lead to false positives: a search for `2024` is likely to match terms such as `2025` and `2004`. + +You can disable typo tolerance for all numeric values across all indexes and search requests: + + + +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. diff --git a/reference/api/settings.mdx b/reference/api/settings.mdx index 32d8af752..a500ee35b 100644 --- a/reference/api/settings.mdx +++ b/reference/api/settings.mdx @@ -2347,6 +2347,7 @@ Typo tolerance helps users find relevant results even when their search queries | **`minWordSizeForTypos.twoTypos`** | Integer | `9` | The minimum word size for accepting 2 typos; must be between `oneTypo` and `255` | | **`disableOnWords`** | Array of strings | Empty | An array of words for which the typo tolerance feature is disabled | | **`disableOnAttributes`** | Array of strings | Empty | An array of attributes for which the typo tolerance feature is disabled | +| **`disableOnNumbers`** | Boolean | `false` | Whether typo tolerance for numbers is disabled or enabled | ### Get typo tolerance settings @@ -2401,6 +2402,7 @@ Partially update the typo tolerance settings for an index. }, "disableOnWords": [, , …], "disableOnAttributes": [, , …] + "disableOnNumbers": , } ``` @@ -2411,6 +2413,7 @@ Partially update the typo tolerance settings for an index. | **`minWordSizeForTypos.twoTypos`** | Integer | `9` | The minimum word size for accepting 2 typos; must be between `oneTypo` and `255` | | **`disableOnWords`** | Array of strings | Empty | An array of words for which the typo tolerance feature is disabled | | **`disableOnAttributes`** | Array of strings | Empty | An array of attributes for which the typo tolerance feature is disabled | +| **`disableOnNumbers`** | Boolean | `false` | Whether typo tolerance for numbers is disabled or enabled | #### Example