File tree Expand file tree Collapse file tree 3 files changed +22
-0
lines changed Expand file tree Collapse file tree 3 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -360,6 +360,10 @@ typo_tolerance_guide_4: |-
360
360
'twoTypos': 10
361
361
}
362
362
})
363
+ typo_tolerance_guide_5 : |-
364
+ client.index('movies').update_typo_tolerance({
365
+ 'disableOnNumbers': True
366
+ })
363
367
search_parameter_guide_show_ranking_score_1 : |-
364
368
client.index('movies').search('dragon', {
365
369
'showRankingScore': True
Original file line number Diff line number Diff line change @@ -44,6 +44,7 @@ class MinWordSizeForTypos(CamelBase):
44
44
45
45
class TypoTolerance (CamelBase ):
46
46
enabled : bool = True
47
+ disable_on_numbers : bool = False
47
48
disable_on_attributes : Optional [List [str ]] = None
48
49
disable_on_words : Optional [List [str ]] = None
49
50
min_word_size_for_typos : Optional [MinWordSizeForTypos ] = None
Original file line number Diff line number Diff line change
1
+ from meilisearch .models .index import TypoTolerance
2
+
1
3
DEFAULT_TYPO_TOLERANCE = {
2
4
"enabled" : True ,
5
+ "disableOnNumbers" : False ,
3
6
"minWordSizeForTypos" : {
4
7
"oneTypo" : 5 ,
5
8
"twoTypos" : 9 ,
10
13
11
14
NEW_TYPO_TOLERANCE = {
12
15
"enabled" : True ,
16
+ "disableOnNumbers" : False ,
13
17
"minWordSizeForTypos" : {
14
18
"oneTypo" : 6 ,
15
19
"twoTypos" : 10 ,
@@ -65,3 +69,16 @@ def test_reset_typo_tolerance(empty_index):
65
69
)
66
70
assert update2 .status == "succeeded"
67
71
assert response_last .model_dump (by_alias = True ) == DEFAULT_TYPO_TOLERANCE
72
+
73
+
74
+ def test_disable_numbers_true (empty_index ):
75
+ index = empty_index ()
76
+
77
+ # Update settings
78
+ response_update = index .update_typo_tolerance ({"disableOnNumbers" : True })
79
+ update = index .wait_for_task (response_update .task_uid )
80
+ assert update .status == "succeeded"
81
+
82
+ # Fetch updated settings
83
+ tolerance : TypoTolerance = index .get_typo_tolerance ()
84
+ assert tolerance .disable_on_numbers
You can’t perform that action at this time.
0 commit comments