Skip to content

Commit b3c15f5

Browse files
add typoTolerance.disableOnNumbers to reference
1 parent 8909b97 commit b3c15f5

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

.code-samples.meilisearch.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -831,6 +831,13 @@ typo_tolerance_guide_4: |-
831831
"twoTypos": 10
832832
}
833833
}'
834+
typo_tolerance_guide_5: |-
835+
curl \
836+
-X PATCH 'MEILISEARCH_URL/indexes/movies/settings/typo-tolerance' \
837+
-H 'Content-Type: application/json' \
838+
--data-binary '{
839+
"disableOnNumbers": true
840+
}'
834841
updating_guide_check_version_new_authorization_header: |-
835842
curl \
836843
-X GET 'http://<your-domain-name>/version' \

learn/relevancy/typo_tolerance_settings.mdx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,13 @@ You can disable typo tolerance for a specific [document attribute](/learn/gettin
6565
<CodeSamplesTypoToleranceGuide2 />
6666

6767
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.
68+
69+
## `disableOnNumbers`
70+
71+
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`.
72+
73+
You can disable typo tolerance for all numeric values across all indexes and search requests:
74+
75+
<CodeSamplesTypoToleranceGuide5 />
76+
77+
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.

reference/api/settings.mdx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2347,6 +2347,7 @@ Typo tolerance helps users find relevant results even when their search queries
23472347
| **`minWordSizeForTypos.twoTypos`** | Integer | `9` | The minimum word size for accepting 2 typos; must be between `oneTypo` and `255` |
23482348
| **`disableOnWords`** | Array of strings | Empty | An array of words for which the typo tolerance feature is disabled |
23492349
| **`disableOnAttributes`** | Array of strings | Empty | An array of attributes for which the typo tolerance feature is disabled |
2350+
| **`disableOnNumbers`** | Boolean | `false` | Whether typo tolerance for numbers is disabled or enabled |
23502351

23512352
### Get typo tolerance settings
23522353

@@ -2401,6 +2402,7 @@ Partially update the typo tolerance settings for an index.
24012402
},
24022403
"disableOnWords": [<String>, <String>, …],
24032404
"disableOnAttributes": [<String>, <String>, …]
2405+
"disableOnNumbers": <Boolean>,
24042406
}
24052407
```
24062408

@@ -2411,6 +2413,7 @@ Partially update the typo tolerance settings for an index.
24112413
| **`minWordSizeForTypos.twoTypos`** | Integer | `9` | The minimum word size for accepting 2 typos; must be between `oneTypo` and `255` |
24122414
| **`disableOnWords`** | Array of strings | Empty | An array of words for which the typo tolerance feature is disabled |
24132415
| **`disableOnAttributes`** | Array of strings | Empty | An array of attributes for which the typo tolerance feature is disabled |
2416+
| **`disableOnNumbers`** | Boolean | `false` | Whether typo tolerance for numbers is disabled or enabled |
24142417

24152418
#### Example
24162419

0 commit comments

Comments
 (0)