@@ -23,10 +23,10 @@ pub struct MinWordSizeForTypos {
23
23
#[ derive( Serialize , Deserialize , Default , Debug , Clone , PartialEq , Eq ) ]
24
24
#[ serde( rename_all = "camelCase" ) ]
25
25
pub struct TypoToleranceSettings {
26
- pub enabled : bool ,
27
- pub disable_on_attributes : Vec < String > ,
28
- pub disable_on_words : Vec < String > ,
29
- pub min_word_size_for_typos : MinWordSizeForTypos ,
26
+ pub enabled : Option < bool > ,
27
+ pub disable_on_attributes : Option < Vec < String > > ,
28
+ pub disable_on_words : Option < Vec < String > > ,
29
+ pub min_word_size_for_typos : Option < MinWordSizeForTypos > ,
30
30
}
31
31
32
32
#[ derive( Serialize , Deserialize , Default , Debug , Clone , Eq , PartialEq ) ]
@@ -1051,10 +1051,12 @@ impl Index {
1051
1051
/// let mut index = client.index("set_typo_tolerance");
1052
1052
///
1053
1053
/// let mut typo_tolerance = TypoToleranceSettings {
1054
- /// enabled: true,
1055
- /// disable_on_attributes: vec!(),
1056
- /// disable_on_words: vec!(),
1057
- /// min_word_size_for_typos: MinWordSizeForTypos { one_typo : 1, two_typos: 2},
1054
+ /// enabled: Some(true),
1055
+ /// disable_on_attributes: None,
1056
+ /// disable_on_words: None,
1057
+ /// min_word_size_for_typos: Some(MinWordSizeForTypos {
1058
+ /// one_typo: 5,
1059
+ /// two_typos: 9})
1058
1060
/// };
1059
1061
///
1060
1062
/// let task = index.set_typo_tolerance(&typo_tolerance).await.unwrap();
@@ -1562,13 +1564,13 @@ mod tests {
1562
1564
#[ meilisearch_test]
1563
1565
async fn test_get_typo_tolerance ( index : Index ) {
1564
1566
let typo_tolerance = TypoToleranceSettings {
1565
- enabled : true ,
1566
- disable_on_attributes : vec ! [ ] ,
1567
- disable_on_words : vec ! [ ] ,
1568
- min_word_size_for_typos : MinWordSizeForTypos {
1567
+ enabled : Some ( true ) ,
1568
+ disable_on_attributes : None ,
1569
+ disable_on_words : None ,
1570
+ min_word_size_for_typos : Some ( MinWordSizeForTypos {
1569
1571
one_typo : 5 ,
1570
1572
two_typos : 9 ,
1571
- } ,
1573
+ } ) ,
1572
1574
} ;
1573
1575
1574
1576
let res = index. get_typo_tolerance ( ) . await . unwrap ( ) ;
@@ -1579,13 +1581,13 @@ mod tests {
1579
1581
#[ meilisearch_test]
1580
1582
async fn test_set_typo_tolerance ( client : Client , index : Index ) {
1581
1583
let typo_tolerance = TypoToleranceSettings {
1582
- enabled : false ,
1583
- disable_on_attributes : vec ! [ ] ,
1584
- disable_on_words : vec ! [ ] ,
1585
- min_word_size_for_typos : MinWordSizeForTypos {
1584
+ enabled : Some ( false ) ,
1585
+ disable_on_attributes : None ,
1586
+ disable_on_words : None ,
1587
+ min_word_size_for_typos : Some ( MinWordSizeForTypos {
1586
1588
one_typo : 6 ,
1587
1589
two_typos : 9 ,
1588
- } ,
1590
+ } ) ,
1589
1591
} ;
1590
1592
let task_info = index. set_typo_tolerance ( & typo_tolerance) . await . unwrap ( ) ;
1591
1593
client. wait_for_task ( task_info, None , None ) . await . unwrap ( ) ;
@@ -1598,22 +1600,22 @@ mod tests {
1598
1600
#[ meilisearch_test]
1599
1601
async fn test_reset_typo_tolerance ( index : Index ) {
1600
1602
let typo_tolerance = TypoToleranceSettings {
1601
- enabled : false ,
1602
- disable_on_attributes : vec ! [ ] ,
1603
- disable_on_words : vec ! [ ] ,
1604
- min_word_size_for_typos : MinWordSizeForTypos {
1603
+ enabled : Some ( false ) ,
1604
+ disable_on_attributes : None ,
1605
+ disable_on_words : None ,
1606
+ min_word_size_for_typos : Some ( MinWordSizeForTypos {
1605
1607
one_typo : 1 ,
1606
1608
two_typos : 2 ,
1607
- } ,
1609
+ } ) ,
1608
1610
} ;
1609
1611
let default = TypoToleranceSettings {
1610
- enabled : true ,
1611
- disable_on_attributes : vec ! [ ] ,
1612
- disable_on_words : vec ! [ ] ,
1613
- min_word_size_for_typos : MinWordSizeForTypos {
1612
+ enabled : Some ( true ) ,
1613
+ disable_on_attributes : None ,
1614
+ disable_on_words : None ,
1615
+ min_word_size_for_typos : Some ( MinWordSizeForTypos {
1614
1616
one_typo : 5 ,
1615
1617
two_typos : 9 ,
1616
- } ,
1618
+ } ) ,
1617
1619
} ;
1618
1620
1619
1621
let task = index. set_typo_tolerance ( & typo_tolerance) . await . unwrap ( ) ;
0 commit comments