Skip to content

Commit dabe471

Browse files
vishalsodaniomid
authored andcommitted
fixed code samples
1 parent af054af commit dabe471

File tree

1 file changed

+68
-25
lines changed

1 file changed

+68
-25
lines changed

.code-samples.meilisearch.yaml

Lines changed: 68 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -153,13 +153,15 @@ update_settings_1: |-
153153
synonyms.insert(String::from("logan"), vec!["wolverine"]);
154154
155155
let min_word_size_for_typos = MinWordSizeForTypos {
156-
one_typo: 4,
157-
two_typos; 12
156+
one_typo: Some(4),
157+
two_typos; Some(12)
158158
}
159-
let typo_tolerance = TypoToleranceSettings::new()
160-
.with_min_word_size_for_typos(min_word_size_for_typos)
161-
.with_disable_on_attributes(["title".to_string()])
162-
;
159+
let typo_tolerance = TypoToleranceSettings {
160+
enabled: Some(true),
161+
disable_on_attributes: Some(vec!["title".to_string()]),
162+
disable_on_words: Some(vec![])
163+
min_word_size_for_typos: Some(min_word_size_for_typos),
164+
};
163165
164166
let settings = Settings::new()
165167
.with_ranking_rules([
@@ -251,8 +253,16 @@ reset_pagination_settings_1: |-
251253
.await
252254
.unwrap();
253255
getting_started_typo_tolerance: |-
254-
let typo_tolerance = TypoToleranceSettings::new()
255-
.with_min_word_size_for_two_typos(4);
256+
let min_word_size_for_typos = MinWordSizeForTypos {
257+
one_typo: Some(5),
258+
two_typos: Some(4)
259+
}
260+
let typo_tolerance = TypoToleranceSettings {
261+
enabled: Some(true),
262+
disable_on_attributes: Some(vec![]),
263+
disable_on_words: Some(vec!["title".to_string()]),
264+
min_word_size_for_typos: Some(min_word_size_for_typos),
265+
};
256266
257267
let task: TaskInfo = client
258268
.index("movies")
@@ -266,8 +276,12 @@ get_typo_tolerance_1: |-
266276
.await
267277
.unwrap();
268278
update_typo_tolerance_1: |-
269-
let typo_tolerance = TypoToleranceSettings::new()
270-
.with_enabled(false);
279+
let typo_tolerance = TypoToleranceSettings {
280+
enabled: Some(false),
281+
disable_on_attributes: Some(vec![]),
282+
disable_on_words: Some(vec![]),
283+
min_word_size_for_typos: Some(MinWordSizeForTypos::default()),
284+
};
271285
272286
let task: TaskInfo = client
273287
.index("books")
@@ -764,9 +778,16 @@ settings_guide_faceting_1: |-
764778
.await
765779
.unwrap();
766780
settings_guide_typo_tolerance_1: |-
767-
let typo_tolerance = TypoToleranceSettings::new()
768-
.with_min_word_size_for_two_typos(12)
769-
.with_disable_on_attributes(["title".to_string()]);
781+
let min_word_size_for_typos = MinWordSizeForTypos {
782+
one_typo: Some(5),
783+
two_typos: Some(12)
784+
}
785+
let typo_tolerance = TypoToleranceSettings {
786+
enabled: Some(true),
787+
disable_on_attributes: Some(vec![]),
788+
disable_on_words: Some(vec!["title".to_string()]),
789+
min_word_size_for_typos: Some(min_word_size_for_typos),
790+
};
770791
771792
let settings = Settings::new()
772793
.with_typo_tolerance(&typo_tolerance);
@@ -777,28 +798,46 @@ settings_guide_typo_tolerance_1: |-
777798
.await
778799
.unwrap();
779800
typo_tolerance_guide_1: |-
780-
let typo_tolerance = TypoToleranceSettings::new()
781-
.with_enabled(false);
801+
let typo_tolerance = TypoToleranceSettings {
802+
enabled: Some(false),
803+
disable_on_attributes: Some(vec![]),
804+
disable_on_words: Some(vec![]),
805+
min_word_size_for_typos: Some(MinWordSizeForTypos::default()),
806+
};
782807
783808
let task: TaskInfo = client
784809
.index("movies")
785810
.set_typo_tolerance(&typo_tolerance)
786811
.await
787812
.unwrap();
788813
typo_tolerance_guide_2: |-
789-
let typo_tolerance = TypoToleranceSettings::new()
790-
.with_min_word_size_for_two_typos(12)
791-
.with_disable_on_attributes(["title".to_string()]);
814+
let min_word_size_for_typos = MinWordSizeForTypos {
815+
one_typo: Some(5),
816+
two_typos: Some(12)
817+
}
818+
let typo_tolerance = TypoToleranceSettings {
819+
enabled: Some(true),
820+
disable_on_attributes: Some(vec!["title".to_string()]),
821+
disable_on_words: Some(vec![]),
822+
min_word_size_for_typos: Some(min_word_size_for_typos),
823+
};
792824
793825
let task: TaskInfo = client
794826
.index("movies")
795827
.set_typo_tolerance(&typo_tolerance)
796828
.await
797829
.unwrap();
798830
typo_tolerance_guide_3: |-
799-
let typo_tolerance = TypoToleranceSettings::new()
800-
.with_min_word_size_for_two_typos(12)
801-
.with_disable_on_words(["shrek".to_string()]);
831+
let min_word_size_for_typos = MinWordSizeForTypos {
832+
one_typo: Some(5),
833+
two_typos: Some(12)
834+
}
835+
let typo_tolerance = TypoToleranceSettings {
836+
enabled: Some(true),
837+
disable_on_attributes: Some(vec![]),
838+
disable_on_words: Some(vec!["shrek".to_string()]),
839+
min_word_size_for_typos: Some(min_word_size_for_typos),
840+
};
802841
803842
let task: TaskInfo = client
804843
.index("movies")
@@ -807,11 +846,15 @@ typo_tolerance_guide_3: |-
807846
.unwrap();
808847
typo_tolerance_guide_4: |-
809848
let min_word_size_for_typos = MinWordSizeForTypos {
810-
one_typo: 4,
811-
two_typos; 12
849+
one_typo: Some(4),
850+
two_typos: Some(12)
851+
};
852+
let typo_tolerance = TypoToleranceSettings {
853+
enabled: Some(true),
854+
disable_on_attributes: Some(vec![]),
855+
disable_on_words: Some(vec!["title".to_string()]),
856+
min_word_size_for_typos: Some(min_word_size_for_typos),
812857
};
813-
let typo_tolerance = TypoToleranceSettings::new()
814-
.with_min_word_size_for_typos(min_word_size_for_typos);
815858
816859
let task: TaskInfo = client
817860
.index("movies")

0 commit comments

Comments
 (0)