Skip to content

Commit f8dcf18

Browse files
Update code samples [skip ci]
1 parent 4dd3823 commit f8dcf18

File tree

35 files changed

+265
-3
lines changed

35 files changed

+265
-3
lines changed

snippets/samples/code_samples_async_guide_filter_by_statuses_1.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ await client.GetTasksAsync(new TasksQuery { Statuses = new List<TaskInfoStatus>
4242
```rust Rust
4343
let mut query = TasksQuery::new(&client);
4444
let tasks = query
45-
.with_statuses(["failed", "canceled"])
45+
.with_statuses(["failed"])
4646
.execute()
4747
.await
4848
.unwrap();

snippets/samples/code_samples_async_guide_filter_by_statuses_2.mdx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,13 @@
44
curl \
55
-X GET 'MEILISEARCH_URL/tasks?statuses=failed,canceled'
66
```
7+
8+
```rust Rust
9+
let mut query = TasksQuery::new(&client);
10+
let tasks = query
11+
.with_statuses(["failed", "canceled"])
12+
.execute()
13+
.await
14+
.unwrap();
15+
```
716
</CodeGroup>

snippets/samples/code_samples_basic_security_tutorial_admin_1.mdx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,12 @@ curl \
1010
"primaryKey": "id"
1111
}'
1212
```
13+
14+
```rust Rust
15+
let client = Client::new("http://localhost:7700", Some("DEFAULT_ADMIN_API_KEY"));
16+
let task = client
17+
.create_index("medical_records", Some("id"))
18+
.await
19+
.unwrap();
20+
```
1321
</CodeGroup>

snippets/samples/code_samples_basic_security_tutorial_listing_1.mdx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,12 @@
44
curl -X GET 'MEILISEARCH_URL/keys' \
55
-H 'Authorization: Bearer MASTER_KEY'
66
```
7+
8+
```rust Rust
9+
let client = Client::new("http://localhost:7700", Some("MASTER_KEY"));
10+
client
11+
.get_keys()
12+
.await
13+
.unwrap();
14+
```
715
</CodeGroup>

snippets/samples/code_samples_basic_security_tutorial_search_1.mdx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,15 @@ curl \
77
-H 'Authorization: Bearer DEFAULT_SEARCH_API_KEY' \
88
--data-binary '{ "q": "appointments" }'
99
```
10+
11+
```rust Rust
12+
let client = Client::new("http://localhost:7700", Some("DEFAULT_SEARCH_API_KEY"));
13+
let index = client.index("medical_records");
14+
index
15+
.search()
16+
.with_query("appointments")
17+
.execute::<MedicalRecord>()
18+
.await
19+
.unwrap();
20+
```
1021
</CodeGroup>

snippets/samples/code_samples_facet_search_1.mdx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,16 @@ var query = new SearchFacetsQuery()
6060
await client.Index("books").FacetSearchAsync("genres", query);
6161
```
6262

63+
```rust Rust
64+
let res = client.index("books")
65+
.facet_search("genres")
66+
.with_facet_query("fiction")
67+
.with_filter("rating > 3")
68+
.execute()
69+
.await
70+
.unwrap();
71+
```
72+
6373
```dart Dart
6474
await client.index('books').facetSearch(
6575
FacetSearchQuery(

snippets/samples/code_samples_facet_search_2.mdx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,20 @@ var newFaceting = new Faceting
6262
await client.Index("books").UpdateFacetingAsync(newFaceting);
6363
```
6464

65+
```rust Rust
66+
let mut facet_sort_setting = BTreeMap::new();
67+
facet_sort_setting.insert("genres".to_string(), FacetSortValue::Count);
68+
let faceting = FacetingSettings {
69+
max_values_per_facet: 100,
70+
sort_facet_values_by: Some(facet_sort_setting),
71+
};
72+
73+
let res = client.index("books")
74+
.set_faceting(&faceting)
75+
.await
76+
.unwrap();
77+
```
78+
6579
```dart Dart
6680
await client.index('books').updateFaceting(
6781
Faceting(

snippets/samples/code_samples_facet_search_3.mdx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,15 @@ var query = new SearchFacetsQuery()
5353
await client.Index("books").FacetSearchAsync("genres", query);
5454
```
5555

56+
```rust Rust
57+
let res = client.index("books")
58+
.facet_search("genres")
59+
.with_facet_query("c")
60+
.execute()
61+
.await
62+
.unwrap();
63+
```
64+
5665
```dart Dart
5766
await client.index('books').facetSearch(
5867
FacetSearchQuery(

snippets/samples/code_samples_get_all_batches_1.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,8 @@ $client->getBatches();
2020
```ruby Ruby
2121
client.batches
2222
```
23+
24+
```go Go
25+
client.GetBatches();
26+
```
2327
</CodeGroup>

snippets/samples/code_samples_get_batch_1.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,8 @@ $client->getBatch(BATCH_UID);
2020
```ruby Ruby
2121
client.batch(BATCH_UID)
2222
```
23+
24+
```go Go
25+
client.GetBatch(BATCH_UID);
26+
```
2327
</CodeGroup>

0 commit comments

Comments
 (0)