From b3c15f5e4df409da51b3c9b1286cf1c57944f0c2 Mon Sep 17 00:00:00 2001 From: gui machiavelli Date: Fri, 16 May 2025 14:59:05 -0300 Subject: [PATCH 1/2] add `typoTolerance.disableOnNumbers` to reference --- .code-samples.meilisearch.yaml | 7 +++++++ learn/relevancy/typo_tolerance_settings.mdx | 10 ++++++++++ reference/api/settings.mdx | 3 +++ 3 files changed, 20 insertions(+) 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 From 7d9c102bcbd65c4d3ae34b26f6d04a01cbc34270 Mon Sep 17 00:00:00 2001 From: gui machiavelli Date: Tue, 20 May 2025 15:20:17 -0300 Subject: [PATCH 2/2] first draft ready --- learn/relevancy/typo_tolerance_settings.mdx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/learn/relevancy/typo_tolerance_settings.mdx b/learn/relevancy/typo_tolerance_settings.mdx index 7062f9e0d..4dd814cf8 100644 --- a/learn/relevancy/typo_tolerance_settings.mdx +++ b/learn/relevancy/typo_tolerance_settings.mdx @@ -68,10 +68,10 @@ With the above settings, matches in the `title` attribute will not tolerate any ## `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: +You can disable typo tolerance for all numeric values across all indexes and search requests by setting `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.