Skip to content

Commit 4e359df

Browse files
bors[bot]meili-bot
andauthored
Merge #412
412: Update code-samples r=bidoubiwa a=meili-bot _This PR is auto-generated._ Update the code-samples.meilisearch.yml according to the [integration-guides issue](meilisearch/integration-guides#216) for more information and the complete description about what should be done here check that issue. :warning: Check the global issue before implementing the code-samples. The issue may have changed since the last time. Co-authored-by: meili-bot <[email protected]>
2 parents 6f0c2e8 + 379688e commit 4e359df

File tree

1 file changed

+69
-2
lines changed

1 file changed

+69
-2
lines changed

.code-samples.meilisearch.yaml

Lines changed: 69 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,65 @@
33
# the documentation on build
44
# You can read more on https://github.com/meilisearch/documentation/tree/master/.vuepress/code-samples
55
---
6+
synonyms_guide_1: |-
7+
let mut synonyms = std::collections::HashMap::new();
8+
synonyms.insert(String::from("great"), vec![String::from("fantastic")]);
9+
synonyms.insert(String::from("fantastic"), vec![String::from("great")]);
10+
11+
let task: TaskInfo = client
12+
.index("movies")
13+
.set_synonyms(&synonyms)
14+
.await
15+
.unwrap();
16+
date_guide_index_1: |-
17+
let mut file = File::open("games.json")
18+
.unwrap();
19+
let mut content = String::new();
20+
file
21+
.read_to_string(&mut content)
22+
.unwrap();
23+
let docs: Vec<Game> = serde_json::from_str(&content)
24+
.unwrap();
25+
26+
client
27+
.index("games")
28+
.add_documents(&docs, None)
29+
.await
30+
.unwrap();
31+
date_guide_filterable_attributes_1: |-
32+
let settings = Settings::new()
33+
.with_filterable_attributes(["release_timestamp"]);
34+
35+
let task: TaskInfo = client
36+
.index("games")
37+
.set_settings(&settings)
38+
.await
39+
.unwrap();
40+
date_guide_filter_1: |-
41+
let results: SearchResults<Game> = client
42+
.index("games")
43+
.search()
44+
.with_filter("release_timestamp >= 1514761200 AND release_timestamp < 1672527600")
45+
.execute()
46+
.await
47+
.unwrap();
48+
date_guide_sortable_attributes_1: |-
49+
let settings = Settings::new()
50+
.with_sortable_attributes(["release_timestamp"]);
51+
52+
let task: TaskInfo = client
53+
.index("games")
54+
.set_settings(&settings)
55+
.await
56+
.unwrap();
57+
date_guide_sort_1: |-
58+
let results: SearchResults<Game> = client
59+
.index("games")
60+
.search()
61+
.with_sort(["release_timestamp:desc"])
62+
.execute()
63+
.await
64+
.unwrap();
665
delete_tasks_1: |-
766
let mut query = tasks::TasksDeleteQuery::new(&client);
867
query.with_uids([1, 2]);
@@ -667,7 +726,7 @@ search_parameter_guide_show_matches_position_1: |-
667726
.collect();
668727
search_parameter_guide_matching_strategy_1: |-
669728
let results: SearchResults<Movie> = client
670-
.index('movies')
729+
.index("movies")
671730
.search()
672731
.with_query("big fat liar")
673732
.with_matching_strategy(MatchingStrategies::LAST)
@@ -676,7 +735,7 @@ search_parameter_guide_matching_strategy_1: |-
676735
.unwrap();
677736
search_parameter_guide_matching_strategy_2: |-
678737
let results: SearchResults<Movie> = client
679-
.index('movies')
738+
.index("movies")
680739
.search()
681740
.with_query("big fat liar")
682741
.with_matching_strategy(MatchingStrategies::ALL)
@@ -1147,6 +1206,14 @@ getting_started_faceting: |-
11471206
.set_faceting(&faceting)
11481207
.await
11491208
.unwrap();
1209+
getting_started_pagination: |-
1210+
let pagination = PaginationSetting {max_total_hits:500};
1211+
1212+
let task: TaskInfo = client
1213+
.index("books")
1214+
.set_pagination(pagination)
1215+
.await
1216+
.unwrap();
11501217
getting_started_filtering: |-
11511218
let results: SearchResults<Meteorite> = client
11521219
.index("meteorites")

0 commit comments

Comments
 (0)