forked from meilisearch/meilisearch-rust
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.code-samples.meilisearch.yaml
691 lines (644 loc) · 22.8 KB
/
.code-samples.meilisearch.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
# This code-samples file is used by the MeiliSearch documentation
# Every example written here will be automatically fetched by
# the documentation on build
# You can read more on https://github.com/meilisearch/documentation/tree/master/.vuepress/code-samples
---
get_one_index_1: |-
let movies: Index = client.get_index("movies").await.unwrap();
list_all_indexes_1: |-
let indexes: Vec<Index> = client.list_all_indexes().await.unwrap();
create_an_index_1: |-
let movies: Index = client.create_index("movies", Some("movie_id")).await.unwrap();
update_an_index_1: |-
client.index("movies").update("movie_review_id").await.unwrap();
delete_an_index_1: |-
client.index("movies").delete().await.unwrap();
get_one_document_1: |-
let movie: Movie = client.index("movies").get_document(String::from("25684")).await.unwrap();
get_documents_1: |-
let documents: Vec<Movie> = client.index("movies").get_documents(None, Some(2), None).await.unwrap();
add_or_replace_documents_1: |-
let progress: Progress = client.index("movies").add_or_replace(&[
Movie {
id: 287947,
title: "Shazam".to_string(),
poster: "https://image.tmdb.org/t/p/w1280/xnopI5Xtky18MPhK40cZAGAOVeV.jpg".to_string(),
overview: "A boy is given the ability to become an adult superhero in times of need with a single magic word.".to_string(),
release_date: "2019-03-23".to_string(),
}
], None).await.unwrap();
add_or_update_documents_1: |-
// Define the type of our documents
#[derive(Serialize, Deserialize, Debug)]
struct IncompleteMovie {
id: usize,
title: String
}
impl Document for IncompleteMovie {
type UIDType = usize;
fn get_uid(&self) -> &Self::UIDType { &self.id }
}
let progress: Progress = client.index("movies").add_or_update(&[
IncompleteMovie {
id: 287947,
title: "Shazam ⚡️".to_string()
}
], None).await.unwrap();
delete_all_documents_1: |-
let progress: Progress = client.index("movies").delete_all_documents().await.unwrap();
delete_one_document_1: |-
let progress: Progress = client.index("movies").delete_document(25684).await.unwrap();
delete_documents_1: |-
let progress: Progress = client.index("movies").delete_documents(&[23488, 153738, 437035, 363869]).await.unwrap();
search_post_1: |-
let results: SearchResults<Movie> = client.index("movies")
.search()
.with_query("American ninja")
.execute()
.await
.unwrap();
get_update_1: |-
// You can get the status of a `Progress` object:
let status: Status = progress.get_status().await.unwrap();
// Or you can use index to get an update status using its `update_id`:
let status: Status = client.index("movies").get_update(1).await.unwrap();
get_all_updates_1: |-
let status: Vec<ProgressStatus> = client.index("movies").get_all_updates().await.unwrap();
get_keys_1: |-
let keys: Keys = client.get_keys().await.unwrap();
get_settings_1: |-
let settings: Settings = client.index("movies").get_settings().await.unwrap();
update_settings_1: |-
let mut synonyms = std::collections::HashMap::new();
synonyms.insert(String::from("wolverine"), vec!["xmen", "logan"]);
synonyms.insert(String::from("logan"), vec!["wolverine"]);
let settings = Settings::new()
.with_ranking_rules([
"words",
"typo",
"proximity",
"attribute",
"sort",
"exactness",
"release_date:desc",
"rank:desc"
])
.with_distinct_attribute("movie_id")
.with_searchable_attributes([
"title",
"description",
"genre"
])
.with_displayed_attributes([
"title",
"description",
"genre",
"release_date"
])
.with_stop_words([
"the",
"a",
"an"
])
.with_sortable_attributes([
"title",
"release_date"
])
.with_synonyms(synonyms);
let progress: Progress = client.index("movies").set_settings(&settings).await.unwrap();
reset_settings_1: |-
let progress: Progress = client.index("movies").reset_settings().await.unwrap();
get_synonyms_1: |-
let synonyms: HashMap<String, Vec<String>> = client.index("movies").get_synonyms().await.unwrap();
update_synonyms_1: |-
let mut synonyms = std::collections::HashMap::new();
synonyms.insert(String::from("wolverine"), vec![String::from("xmen"), String::from("logan")]);
synonyms.insert(String::from("logan"), vec![String::from("xmen"), String::from("wolverine")]);
synonyms.insert(String::from("wow"), vec![String::from("world of warcraft")]);
let progress: Progress = client.index("movies").set_synonyms(&synonyms).await.unwrap();
reset_synonyms_1: |-
let progress: Progress = client.index("movies").reset_synonyms().await.unwrap();
get_stop_words_1: |-
let stop_words: Vec<String> = client.index("movies").get_stop_words().await.unwrap();
update_stop_words_1: |-
let stop_words = ["of", "the", "to"];
let progress: Progress = client.index("movies").set_stop_words(&stop_words).await.unwrap();
reset_stop_words_1: |-
let progress: Progress = client.index("movies").reset_stop_words().await.unwrap();
get_ranking_rules_1: |-
let ranking_rules: Vec<String> = client.index("movies").get_ranking_rules().await.unwrap();
update_ranking_rules_1: |-
let ranking_rules = [
"words",
"typo",
"proximity",
"attribute",
"sort",
"exactness",
"release_date:asc",
"rank:desc",
];
let progress: Progress = client.index("movies").set_ranking_rules(&ranking_rules).await.unwrap();
reset_ranking_rules_1: |-
let progress: Progress = client.index("movies").reset_ranking_rules().await.unwrap();
get_distinct_attribute_1: |-
let distinct_attribute: Option<String> = client.index("shoes").get_distinct_attribute().await.unwrap();
update_distinct_attribute_1: |-
let progress: Progress = client.index("shoes").set_distinct_attribute("skuid").await.unwrap();
reset_distinct_attribute_1: |-
let progress: Progress = client.index("shoes").reset_distinct_attribute().await.unwrap();
get_searchable_attributes_1: |-
let searchable_attributes: Vec<String> = client.index("movies").get_searchable_attributes().await.unwrap();
update_searchable_attributes_1: |-
let searchable_attributes = [
"title",
"description",
"genre"
];
let progress: Progress = client.index("movies").set_searchable_attributes(&searchable_attributes).await.unwrap();
reset_searchable_attributes_1: |-
let progress: Progress = client.index("movies").reset_searchable_attributes().await.unwrap();
get_filterable_attributes_1: |-
let filterable_attributes: Vec<String> = client.index("movies").get_filterable_attributes().await.unwrap();
update_filterable_attributes_1: |-
let filterable_attributes = [
"genres",
"director"
];
let progress: Progress = client.index("movies").set_filterable_attributes(&filterable_attributes).await.unwrap();
reset_filterable_attributes_1: |-
let progress: Progress = client.index("movies").reset_filterable_attributes().await.unwrap();
get_displayed_attributes_1: |-
let displayed_attributes: Vec<String> = client.index("movies").get_displayed_attributes().await.unwrap();
update_displayed_attributes_1: |-
let displayed_attributes = [
"title",
"description",
"genre",
"release_date"
];
let progress: Progress = client.index("movies").set_displayed_attributes(&displayed_attributes).await.unwrap();
reset_displayed_attributes_1: |-
let progress: Progress = client.index("movies").reset_displayed_attributes().await.unwrap();
get_index_stats_1: |-
let stats: IndexStats = client.index("movies").get_stats().await.unwrap();
get_indexes_stats_1: |-
let stats: ClientStats = client.get_stats().await.unwrap();
get_health_1: |-
// health() return an Err() if the server is not healthy, so this example would panic due to the unwrap
client.health().await.unwrap();
get_version_1: |-
let version: Version = client.get_version().await.unwrap();
distinct_attribute_guide_1: |-
let progress: Progress = client.index("jackets").set_distinct_attribute("product_id").await.unwrap();
field_properties_guide_searchable_1: |-
let searchable_attributes = [
"title",
"description",
"genre"
];
let progress: Progress = client.index("movies").set_searchable_attributes(&searchable_attributes).await.unwrap();
field_properties_guide_displayed_1: |-
let displayed_attributes = [
"title",
"description",
"genre",
"release_date"
];
let progress: Progress = client.index("movies").set_displayed_attributes(&displayed_attributes).await.unwrap();
filtering_guide_1: |-
let results: SearchResults<Movie> = client.index("movies").search()
.with_query("Avengers")
.with_filter("release_date > 795484800")
.execute()
.await
.unwrap();
filtering_guide_2: |-
let results: SearchResults<Movie> = client.index("movies").search()
.with_query("Batman")
.with_filter(r#"release_date > 795484800 AND (director = "Tim Burton" OR director = "Christopher Nolan")"#)
.execute()
.await
.unwrap();
filtering_guide_3: |-
let results: SearchResults<Movie> = client.index("movies").search()
.with_query("horror")
.with_filter(r#"director = "Jordan Peele""#)
.execute()
.await
.unwrap();
filtering_guide_4: |-
let results: SearchResults<Movie> = client.index("movies").search()
.with_query("Planet of the Apes")
.with_filter(r#"rating >= 3 AND (NOT director = "Tim Burton")"#)
.execute()
.await
.unwrap();
search_parameter_guide_query_1: |-
let results: SearchResults<Movie> = client.index("movies").search()
.with_query("shifu")
.execute()
.await
.unwrap();
search_parameter_guide_offset_1: |-
let results: SearchResults<Movie> = client.index("movies").search()
.with_query("shifu")
.with_offset(1)
.execute()
.await
.unwrap();
search_parameter_guide_limit_1: |-
let results: SearchResults<Movie> = client.index("movies").search()
.with_query("shifu")
.with_limit(2)
.execute()
.await
.unwrap();
search_parameter_guide_retrieve_1: |-
let results: SearchResults<Movie> = client.index("movies").search()
.with_query("shifu")
.with_attributes_to_retrieve(Selectors::Some(&["overview", "title"]))
.execute()
.await
.unwrap();
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)
.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_highlight_1: |-
let results: SearchResults<Movie> = client.index("movies").search()
.with_query("winter feast")
.with_attributes_to_highlight(Selectors::Some(&["overview"]))
.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_filter_1: |-
let results: SearchResults<Movie> = client.index("movies").search()
.with_query("n")
.with_filter("title = Nightshift")
.execute()
.await
.unwrap();
search_parameter_guide_filter_2: |-
let results: SearchResults<Movie> = client.index("movies").search()
.with_query("shifu")
.with_filter(r#"title = "Kung Fu Panda""#)
.execute()
.await
.unwrap();
search_parameter_guide_matches_1: |-
let results: SearchResults<Movie> = client.index("movies").search()
.with_query("winter feast")
.with_matches(true)
.execute()
.await
.unwrap();
// Get the matches info
let matched_info: Vec<&HashMap<String, Vec<MatchRange>>> = results.hits.iter().map(|r| r.matches_info.as_ref().unwrap()).collect();
settings_guide_synonyms_1: |-
let mut synonyms = HashMap::new();
synonyms.insert(String::from("sweater"), vec![String::from("jumper")]);
synonyms.insert(String::from("jumper"), vec![String::from("sweater")]);
let settings = Settings::new()
.with_synonyms(synonyms);
let progress = client.index("tops").set_settings(&settings).await.unwrap();
settings_guide_stop_words_1: |-
let settings = Settings::new()
.with_stop_words([
"the",
"a",
"an"
]);
let progress = client.index("movies").set_settings(&settings).await.unwrap();
settings_guide_filterable_attributes_1: |-
let settings = Settings::new()
.with_filterable_attributes([
"director",
"genres"
]);
let progress: Progress = client.index("movies").set_settings(&settings).await.unwrap();
settings_guide_ranking_rules_1: |-
let settings = Settings::new()
.with_ranking_rules([
"words",
"typo",
"proximity",
"attribute",
"sort",
"exactness",
"release_date:asc",
"rank:desc",
]);
let progress = client.index("movies").set_settings(&settings).await.unwrap();
settings_guide_distinct_1: |-
let settings = Settings::new()
.with_distinct_attribute("product_id");
let progress: Progress = client.index("jackets").set_settings(&settings).await.unwrap();
settings_guide_searchable_1: |-
let settings = Settings::new()
.with_searchable_attributes([
"title",
"description",
"genre"
]);
let progress: Progress = client.index("movies").set_settings(&settings).await.unwrap();
settings_guide_displayed_1: |-
let settings = Settings::new()
.with_displayed_attributes([
"title",
"description",
"genre",
"release_date"
]);
let progress: Progress = client.index("movies").set_settings(&settings).await.unwrap();
settings_guide_sortable_1: |-
let mut synonyms = std::collections::HashMap::new();
synonyms.insert(String::from("wolverine"), vec!["xmen", "logan"]);
synonyms.insert(String::from("logan"), vec!["wolverine"]);
let settings = Settings::new()
.with_sortable_attributes([
"title",
"release_date"
]);
let progress: Progress = movies.set_settings(&settings).await.unwrap();
add_movies_json_1: |-
use meilisearch_sdk::{
indexes::*,
document::*,
client::*,
search::*,
progress::*,
settings::*
};
use serde::{Serialize, Deserialize};
use std::{io::prelude::*, fs::File};
use futures::executor::block_on;
fn main() { block_on(async move {
let client = Client::new("http://localhost:7700", "masterKey");
// reading and parsing the file
let mut file = File::open("movies.json").unwrap();
let mut content = String::new();
file.read_to_string(&mut content).unwrap();
let movies_docs: Vec<Movie> = serde_json::from_str(&content).unwrap();
// adding documents
client.index("movies").add_documents(&movies_docs, None).await.unwrap();
})}
documents_guide_add_movie_1: |-
// Define the type of our documents
#[derive(Serialize, Deserialize, Debug)]
struct IncompleteMovie {
id: String,
title: String
}
impl Document for IncompleteMovie {
type UIDType = String;
fn get_uid(&self) -> &Self::UIDType { &self.id }
}
// Add a document to our index
let progress: Progress = client.index("movies").add_documents(&[
IncompleteMovie {
id: "123sq178".to_string(),
title: "Amélie Poulain".to_string(),
}
], None).await.unwrap();
search_guide_1: |-
let results: SearchResults<Movie> = client.index("movies").search()
.with_query("shifu")
.with_limit(5)
.with_offset(10)
.execute()
.await
.unwrap();
search_guide_2: |-
let results: SearchResults<Movie> = client.index("movies").search()
.with_query("Avengers")
.with_filter("release_date > 795484800")
.execute()
.await
.unwrap();
getting_started_add_documents_md: |-
```toml
[dependencies]
meilisearch-sdk = "0.13"
# futures: because we want to block on futures
futures = "0.3"
# serde: required if you are going to use documents
serde = { version="1.0", features = ["derive"] }
# serde_json: required in some parts of this guide
serde_json = "1.0"
```
Documents in the Rust library are strongly typed.
You have to implement the `Document` trait on a struct to be able to use it with Meilisearch.
```rust
#[derive(Serialize, Deserialize, Debug)]
struct Movie {
id: String,
title: String,
poster: String,
overview: String,
release_date: i64,
genres: Vec<String>
}
impl Document for Movie {
type UIDType = String;
fn get_uid(&self) -> &Self::UIDType { &self.id }
}
```
You will often need this `Movie` struct in other parts of this documentation. (you will have to change it a bit sometimes)
You can also use schemaless values, by putting a `serde_json::Value` inside your own struct like this:
```rust
#[derive(Serialize, Deserialize, Debug)]
struct Movie {
id: String,
#[serde(flatten)]
value: serde_json::Value,
}
impl Document for Movie {
type UIDType = String;
fn get_uid(&self) -> &Self::UIDType { &self.id }
}
```
Then, add documents into the index:
```rust
use meilisearch_sdk::{
indexes::*,
document::*,
client::*,
search::*,
progress::*,
settings::*
};
use serde::{Serialize, Deserialize};
use std::{io::prelude::*, fs::File};
use futures::executor::block_on;
fn main() { block_on(async move {
let client = Client::new("http://localhost:7700", "masterKey");
// reading and parsing the file
let mut file = File::open("movies.json").unwrap();
let mut content = String::new();
file.read_to_string(&mut content).unwrap();
let movies_docs: Vec<Movie> = serde_json::from_str(&content).unwrap();
// adding documents
client.index("movies").add_documents(&movies_docs, None).await.unwrap();
})}
```
[About this SDK](https://github.com/meilisearch/meilisearch-rust/)
getting_started_search_md: |-
You can build a `Query` and execute it later:
```rust
let query: Query = Query::new(&movies)
.with_query("botman")
.build();
let results: SearchResults<Movie> = client.index("movies").execute_query(&query).await.unwrap();
```
You can build a `Query` and execute it directly:
```rust
let results: SearchResults<Movie> = Query::new(&movies)
.with_query("botman")
.execute()
.await
.unwrap();
```
You can search in an index directly:
```rust
let results: SearchResults<Movie> = client.index("movies").search()
.with_query("botman")
.execute()
.await
.unwrap();
```
[About this SDK](https://github.com/meilisearch/meilisearch-rust/)
faceted_search_update_settings_1: |-
let progress: Progress = client.index("movies").set_filterable_attributes(["director", "genres"]).await.unwrap();
faceted_search_filter_1: |-
let results: SearchResults<Movie> = client.index("movies").search()
.with_query("thriller")
.with_filter("(genres = Horror AND genres = Mystery) OR director = \"Jordan Peele\"")
.execute()
.await
.unwrap();
faceted_search_facets_distribution_1: |-
let results: SearchResults<Movie> = client.index("movies").search()
.with_query("Batman")
.with_facets_distribution(Selectors::Some(&["genres"]))
.execute()
.await
.unwrap();
let genres: &HashMap<String, usize> = results.facets_distribution.unwrap().get("genres").unwrap();
faceted_search_walkthrough_filterable_attributes_1: |-
let filterable_attributes = [
"director",
"producer",
"genres",
"production_companies"
];
let progress: Progress = client.index("movies").set_filterable_attributes(&filterable_attributes).await.unwrap();
faceted_search_walkthrough_filter_1: |-
let results: SearchResults<Movie> = client.index("movies").search()
.with_query("thriller")
.with_filter("(genres = Horror AND genres = Mystery) OR director = \"Jordan Peele\"")
.execute()
.await
.unwrap();
faceted_search_walkthrough_facets_distribution_1: |-
let results: SearchResults<Movie> = client.index("movies").search()
.with_query("Batman")
.with_facets_distribution(Selectors::Some(&["genres"]))
.execute()
.await
.unwrap();
let genres: &HashMap<String, usize> = results.facets_distribution.unwrap().get("genres").unwrap();
post_dump_1: |-
client.create_dump().await.unwrap();
get_dump_status_1: |-
client.get_dump_status("20201101-110357260").await.unwrap();
phrase_search_1: |-
let results: SearchResults<Movie> = client.index("movies")
.search()
.with_query("\"african american\" horror")
.execute()
.await
.unwrap();
sorting_guide_update_sortable_attributes_1: |-
let sortable_attributes = [
"author",
"price"
];
let progress: Progress = client.index("books").set_sortable_attributes(&sortable_attributes).await.unwrap();
sorting_guide_update_ranking_rules_1: |-
let ranking_rules = [
"words",
"sort",
"typo",
"proximity",
"attribute",
"exactness"
];
let progress: Progress = client.index("books").set_ranking_rules(&ranking_rules).await.unwrap();
sorting_guide_sort_parameter_1: |-
let results: SearchResults<Books> = client.index("books").search()
.with_query("science fiction")
.with_sort(&["price:asc"])
.execute()
.await
.unwrap();
sorting_guide_sort_parameter_2: |-
let results: SearchResults<Books> = client.index("books").search()
.with_query("butler")
.with_sort(&["author:desc"])
.execute()
.await
.unwrap();
get_sortable_attributes_1: |-
let sortable_attributes: Vec<String> = client.index("books").get_sortable_attributes().await.unwrap();
update_sortable_attributes_1: |-
let sortable_attributes = [
"price",
"author"
];
let progress: Progress = client.index("books").set_sortable_attributes(&sortable_attributes).await.unwrap();
reset_sortable_attributes_1: |-
let progress: Progress = client.index("books").reset_sortable_attributes().await.unwrap();
search_parameter_guide_sort_1: |-
let results: SearchResults<Books> = client.index("books").search()
.with_query("science fiction")
.with_sort(&["price:asc"])
.execute()
.await
.unwrap();
geosearch_guide_filter_settings_1: |-
let progress: Progress = client.index("restaurants").set_filterable_attributes(&["_geo"]).await.unwrap();
geosearch_guide_filter_usage_1: |-
let results: SearchResults<Restaurant> = client.index("restaurants").search()
.with_filter("_geoRadius(45.4628328, 9.1076931, 2000)")
.execute()
.await
.unwrap();
geosearch_guide_filter_usage_2: |-
let results: SearchResults<Restaurant> = client.index("restaurants").search()
.with_filter("_geoRadius(45.4628328, 9.1076931, 2000) AND type = pizza")
.execute()
.await
.unwrap();
geosearch_guide_sort_settings_1: |-
let progress: Progress = client.index("restaurants").set_sortable_attributes(&["_geo"]).await.unwrap();
geosearch_guide_sort_usage_1: |-
let results: SearchResults<Restaurant> = client.index("restaurants").search()
.with_sort(&["_geoPoint(48.8583701,2.2922926):asc"])
.execute()
.await
.unwrap();
geosearch_guide_sort_usage_2: |-
let results: SearchResults<Restaurant> = client.index("restaurants").search()
.with_sort(&["_geoPoint(48.8583701,2.2922926):asc", "rating:desc"])
.execute()
.await
.unwrap();