Skip to content

Commit

Permalink
Add typo tolerance sample
Browse files Browse the repository at this point in the history
  • Loading branch information
alallema committed May 5, 2022
1 parent 193482c commit 9076458
Showing 1 changed file with 52 additions and 2 deletions.
54 changes: 52 additions & 2 deletions .code-samples.meilisearch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,22 @@ update_displayed_attributes_1: |-
});
reset_displayed_attributes_1: |-
client.index("movies").resetDisplayedAttributesSettings();
get_typo_tolerance_1:
client.index("books").getTypoToleranceSettings();
update_typo_tolerance_1: |-
TypoTolerance typoTolerance = new TypoTolerance();
typoTolerance.setDisableOnAttributes(new String[] {"title"});
HashMap<String, Integer> minWordSizeTypos =
new HashMap<String, Integer>() {
{
put("oneTypo", 4);
put("twoTypos", 10);
}
};
typoTolerance.setMinWordSizeForTypos(minWordSizeTypos);
client.index("movies").updateTypoToleranceSettings(typoTolerance);
reset_typo_tolerance_1: |-
client.index("books").resetTypoToleranceSettings();
get_index_stats_1: |-
client.index("movies").getStats();
get_indexes_stats_1: |-
Expand Down Expand Up @@ -261,11 +277,11 @@ search_parameter_guide_crop_marker_1: |-
client.index("movies").search(searchRequest);
search_parameter_guide_highlight_1: |-
SearchRequest searchRequest =
new SearchRequest("and").setAttributesToHighlight(new String[] {"overview"});
new SearchRequest("winter feast").setAttributesToHighlight(new String[] {"overview"});
client.index("movies").search(searchRequest);
search_parameter_guide_highlight_tag_1: |-
SearchRequest searchRequest =
new SearchRequest("and")
new SearchRequest("winter feast")
.setAttributesToHighlight(new String[] {"overview"})
.setHighlightPreTag("<span class=\"highlight\">")
.setHighlightPostTag("</span>");
Expand Down Expand Up @@ -334,6 +350,40 @@ settings_guide_sortable_1: |-
"author",
});
client.index("books").updateSettings(settings);
settings_guide_typo_tolerance_1: |-
TypoTolerance typoTolerance = new TypoTolerance();
typoTolerance.setDisableOnAttributes(new String[] {"title"});
HashMap<String, Integer> minWordSizeTypos =
new HashMap<String, Integer>() {
{
put("twoTypos", 12);
}
};
typoTolerance.setMinWordSizeForTypos(minWordSizeTypos);
client.index("movies").updateTypoToleranceSettings(typoTolerance);
typo_tolerance_guide_1: |-
TypoTolerance typoTolerance = new TypoTolerance();
typoTolerance.setEnabled(false);
client.index("movies").updateTypoToleranceSettings(typoTolerance);
typo_tolerance_guide_2: |-
TypoTolerance typoTolerance = new TypoTolerance();
typoTolerance.setDisableOnAttributes(new String[] {"title"});
client.index("movies").updateTypoToleranceSettings(typoTolerance);
typo_tolerance_guide_3: |-
TypoTolerance typoTolerance = new TypoTolerance();
typoTolerance.setDisableOnWords(new String[] {"shrek"});
client.index("movies").updateTypoToleranceSettings(typoTolerance);
typo_tolerance_guide_4: |-
TypoTolerance typoTolerance = new TypoTolerance();
HashMap<String, Integer> minWordSizeTypos =
new HashMap<String, Integer>() {
{
put("oneTypo", 4);
put("twoTypos", 10);
}
};
typoTolerance.setMinWordSizeForTypos(minWordSizeTypos);
client.index("movies").updateTypoToleranceSettings(typoTolerance);
documents_guide_add_movie_1: |-
client.index("movies").addDocuments("[{"
+ "\"movie_id\": 123sq178,"
Expand Down

0 comments on commit 9076458

Please sign in to comment.