From 259aa89d1dc2576c37ec8cc7ee615841ebe967d4 Mon Sep 17 00:00:00 2001 From: Charlotte Vermandel Date: Tue, 26 Apr 2022 15:33:18 +0200 Subject: [PATCH] Update the code samples --- .code-samples.meilisearch.yaml | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/.code-samples.meilisearch.yaml b/.code-samples.meilisearch.yaml index 404f7b6c..b3ed1dab 100644 --- a/.code-samples.meilisearch.yaml +++ b/.code-samples.meilisearch.yaml @@ -263,7 +263,18 @@ search_parameter_guide_crop_1: |- let results: SearchResults = client.index("movies").search() .with_query("shifu") .with_attributes_to_crop(Selectors::Some(&[("overview", None)])) - .with_crop_length(10) + .with_crop_length(5) + .execute() + .await + .unwrap(); + + // Get the formatted results + let formatted_results: Vec<&Movie> = results.hits.iter().map(|r| r.formatted_result.as_ref().unwrap()).collect(); +search_parameter_guide_crop_marker_1: |- + let results: SearchResults = client.index("movies").search() + .with_query("shifu") + .with_attributes_to_crop(Selectors::Some(&[("overview", None)])) + .with_crop_marker("[…]") .execute() .await .unwrap(); @@ -278,6 +289,18 @@ search_parameter_guide_highlight_1: |- .await .unwrap(); + // Get the formatted results + let formatted_results: Vec<&Movie> = results.hits.iter().map(|r| r.formatted_result.as_ref().unwrap()).collect(); +search_parameter_guide_highlight_tag_1: |- + let results: SearchResults = client.index("movies").search() + .with_query("winter feast") + .with_attributes_to_highlight(Selectors::Some(&["overview"])) + .with_highlight_pre_tag("") + .with_highlight_post_tag("") + .execute() + .await + .unwrap(); + // Get the formatted results let formatted_results: Vec<&Movie> = results.hits.iter().map(|r| r.formatted_result.as_ref().unwrap()).collect(); search_parameter_guide_matches_1: |-