Skip to content

Commit

Permalink
Update the code samples (#277)
Browse files Browse the repository at this point in the history
  • Loading branch information
bidoubiwa authored Apr 27, 2022
1 parent 413b04a commit a5d74bd
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion .code-samples.meilisearch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,18 @@ search_parameter_guide_crop_1: |-
let results: SearchResults<Movie> = 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<Movie> = client.index("movies").search()
.with_query("shifu")
.with_attributes_to_crop(Selectors::Some(&[("overview", None)]))
.with_crop_marker("[…]")
.execute()
.await
.unwrap();
Expand All @@ -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<Movie> = client.index("movies").search()
.with_query("winter feast")
.with_attributes_to_highlight(Selectors::Some(&["overview"]))
.with_highlight_pre_tag("<span class=\"highlight\">")
.with_highlight_post_tag("</span>")
.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: |-
Expand Down

0 comments on commit a5d74bd

Please sign in to comment.