Skip to content

Commit 4cdb85f

Browse files
bors[bot]meili-botcurquizajuzi5201314
authored
Merge #130
130: Changes related to the next MeiliSearch release (v0.21.0) r=curquiza a=meili-bot Related to this issue: meilisearch/integration-guides#117 This PR: - gathers the changes related to the next MeiliSearch release (v0.21.0) so that this package is ready when the official release is out. - should pass the tests against the [latest pre-release of MeiliSearch](https://github.com/meilisearch/MeiliSearch/releases). Until there is an RC version, the tests should be valid against the [alpha versions of transplant](https://github.com/meilisearch/transplant/releases). - might eventually contain test failures until the MeiliSearch v0.21.0 is out. ⚠️ This PR should NOT be merged until the next release of MeiliSearch (v0.21.0) is out. _This PR is auto-generated for the [pre-release week](https://github.com/meilisearch/integration-guides/blob/master/guides/pre-release-week.md) purpose. Exceptionally for this release, the pre-release time will be more than just one week._ Co-authored-by: meili-bot <[email protected]> Co-authored-by: Clémentine Urquizar <[email protected]> Co-authored-by: orange soeur <[email protected]>
2 parents f6477d1 + 1af1c51 commit 4cdb85f

File tree

10 files changed

+173
-176
lines changed

10 files changed

+173
-176
lines changed

.code-samples.meilisearch.yaml

Lines changed: 66 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,10 @@ update_settings_1: |-
7878
7979
let settings = Settings::new()
8080
.with_ranking_rules([
81-
"typo",
8281
"words",
82+
"typo",
8383
"proximity",
8484
"attribute",
85-
"wordsPosition",
8685
"exactness",
8786
"desc(release_date)",
8887
"desc(rank)"
@@ -131,11 +130,10 @@ get_ranking_rules_1: |-
131130
let ranking_rules: Vec<String> = movies.get_ranking_rules().await.unwrap();
132131
update_ranking_rules_1: |-
133132
let ranking_rules = [
134-
"typo",
135133
"words",
134+
"typo",
136135
"proximity",
137136
"attribute",
138-
"wordsPosition",
139137
"exactness",
140138
"asc(release_date)",
141139
"desc(rank)",
@@ -162,17 +160,17 @@ update_searchable_attributes_1: |-
162160
let progress: Progress = movies.set_searchable_attributes(&searchable_attributes).await.unwrap();
163161
reset_searchable_attributes_1: |-
164162
let progress: Progress = movies.reset_searchable_attributes().await.unwrap();
165-
get_attributes_for_faceting_1: |-
166-
let attributes_for_faceting: Vec<String> = movies.get_attributes_for_faceting().await.unwrap();
167-
update_attributes_for_faceting_1: |-
168-
let attributes_for_faceting = [
163+
get_filterable_attributes_1: |-
164+
let filterable_attributes: Vec<String> = movies.get_filterable_attributes().await.unwrap();
165+
update_filterable_attributes_1: |-
166+
let filterable_attributes = [
169167
"genres",
170168
"director"
171169
];
172170
173-
let progress: Progress = movies.set_attributes_for_faceting(&attributes_for_faceting).await.unwrap();
174-
reset_attributes_for_faceting_1: |-
175-
let progress: Progress = movies.reset_attributes_for_faceting().await.unwrap();
171+
let progress: Progress = movies.set_filterable_attributes(&filterable_attributes).await.unwrap();
172+
reset_filterable_attributes_1: |-
173+
let progress: Progress = movies.reset_filterable_attributes().await.unwrap();
176174
get_displayed_attributes_1: |-
177175
let displayed_attributes: Vec<String> = movies.get_displayed_attributes().await.unwrap();
178176
update_displayed_attributes_1: |-
@@ -218,28 +216,28 @@ field_properties_guide_displayed_1: |-
218216
filtering_guide_1: |-
219217
let results: SearchResults<Movie> = movies.search()
220218
.with_query("Avengers")
221-
.with_filters("release_date > 795484800")
219+
.with_filter("release_date > 795484800")
222220
.execute()
223221
.await
224222
.unwrap();
225223
filtering_guide_2: |-
226224
let results: SearchResults<Movie> = movies.search()
227225
.with_query("Batman")
228-
.with_filters(r#"release_date > 795484800 AND (director = "Tim Burton" OR director = "Christopher Nolan")"#)
226+
.with_filter(r#"release_date > 795484800 AND (director = "Tim Burton" OR director = "Christopher Nolan")"#)
229227
.execute()
230228
.await
231229
.unwrap();
232230
filtering_guide_3: |-
233231
let results: SearchResults<Movie> = movies.search()
234232
.with_query("horror")
235-
.with_filters(r#"director = "Jordan Peele""#)
233+
.with_filter(r#"director = "Jordan Peele""#)
236234
.execute()
237235
.await
238236
.unwrap();
239237
filtering_guide_4: |-
240238
let results: SearchResults<Movie> = movies.search()
241239
.with_query("Planet of the Apes")
242-
.with_filters(r#"rating >= 3 AND (NOT director = "Tim Burton")"#)
240+
.with_filter(r#"rating >= 3 AND (NOT director = "Tim Burton")"#)
243241
.execute()
244242
.await
245243
.unwrap();
@@ -283,7 +281,7 @@ search_parameter_guide_crop_1: |-
283281
let formatted_results: Vec<&Movie> = results.hits.iter().map(|r| r.formatted_result.as_ref().unwrap()).collect();
284282
search_parameter_guide_highlight_1: |-
285283
let results: SearchResults<Movie> = movies.search()
286-
.with_query("shifu")
284+
.with_query("winter feast")
287285
.with_attributes_to_highlight(Selectors::Some(&["overview"]))
288286
.execute()
289287
.await
@@ -294,22 +292,20 @@ search_parameter_guide_highlight_1: |-
294292
search_parameter_guide_filter_1: |-
295293
let results: SearchResults<Movie> = movies.search()
296294
.with_query("n")
297-
.with_filters("title = Nightshift")
295+
.with_filter("title = Nightshift")
298296
.execute()
299297
.await
300298
.unwrap();
301299
search_parameter_guide_filter_2: |-
302300
let results: SearchResults<Movie> = movies.search()
303-
.with_query("n")
304-
.with_filters(r#"title = "Kung Fu Panda""#)
301+
.with_query("shifu")
302+
.with_filter(r#"title = "Kung Fu Panda""#)
305303
.execute()
306304
.await
307305
.unwrap();
308306
search_parameter_guide_matches_1: |-
309307
let results: SearchResults<Movie> = movies.search()
310-
.with_query("n")
311-
.with_filters(r#"title="Kung Fu Panda""#)
312-
.with_attributes_to_highlight(Selectors::Some(&["overview"]))
308+
.with_query("winter feast")
313309
.with_matches(true)
314310
.execute()
315311
.await
@@ -326,15 +322,14 @@ settings_guide_synonyms_1: |-
326322
let progress: Progress = tops.set_synonyms(&synonyms).await.unwrap();
327323
settings_guide_stop_words_1: |-
328324
let progress: Progress = movies.set_stop_words(["the", "a", "an"]).await.unwrap();
329-
settings_guide_attributes_for_faceting_1: |-
330-
let progress: Progress = movies.set_attributes_for_faceting(["director", "genres"]).await.unwrap();
325+
settings_guide_filterable_attributes_1: |-
326+
let progress: Progress = movies.set_filterable_attributes(["director", "genres"]).await.unwrap();
331327
settings_guide_ranking_rules_1: |-
332328
let ranking_rules = [
333-
"typo",
334329
"words",
330+
"typo",
335331
"proximity",
336332
"attribute",
337-
"wordsPosition",
338333
"exactness",
339334
"asc(release_date)",
340335
"desc(rank)",
@@ -361,6 +356,32 @@ settings_guide_displayed_1: |-
361356
];
362357
363358
let progress: Progress = movies.set_displayed_attributes(&displayed_attributes).await.unwrap();
359+
add_movies_json_1: |-
360+
use meilisearch_sdk::{
361+
indexes::*,
362+
document::*,
363+
client::*,
364+
search::*,
365+
progress::*,
366+
settings::*
367+
};
368+
use serde::{Serialize, Deserialize};
369+
use std::{io::prelude::*, fs::File};
370+
use futures::executor::block_on;
371+
372+
fn main() { block_on(async move {
373+
let client = Client::new("http://localhost:7700", "masterKey");
374+
375+
// reading and parsing the file
376+
let mut file = File::open("movies.json").unwrap();
377+
let mut content = String::new();
378+
file.read_to_string(&mut content).unwrap();
379+
let movies_docs: Vec<Movie> = serde_json::from_str(&content).unwrap();
380+
381+
// adding documents
382+
let movies = client.get_or_create_index("movies").await.unwrap();
383+
movies.add_documents(&movies_docs, None).await.unwrap();
384+
})}
364385
documents_guide_add_movie_1: |-
365386
// Define the type of our documents
366387
#[derive(Serialize, Deserialize, Debug)]
@@ -391,7 +412,7 @@ search_guide_1: |-
391412
search_guide_2: |-
392413
let results: SearchResults<Movie> = movies.search()
393414
.with_query("Avengers")
394-
.with_filters("release_date > 795484800")
415+
.with_filter("release_date > 795484800")
395416
.execute()
396417
.await
397418
.unwrap();
@@ -475,7 +496,7 @@ getting_started_add_documents_md: |-
475496
476497
[About this SDK](https://github.com/meilisearch/meilisearch-rust/)
477498
getting_started_search_md: |-
478-
You can build a Query and execute it later:
499+
You can build a `Query` and execute it later:
479500
```rust
480501
let query: Query = Query::new(&movies)
481502
.with_query("botman")
@@ -484,7 +505,7 @@ getting_started_search_md: |-
484505
let results: SearchResults<Movie> = movies.execute_query(&query).await.unwrap();
485506
```
486507
487-
You can build a Query and execute it directly:
508+
You can build a `Query` and execute it directly:
488509
```rust
489510
let results: SearchResults<Movie> = Query::new(&movies)
490511
.with_query("botman")
@@ -493,7 +514,7 @@ getting_started_search_md: |-
493514
.unwrap();
494515
```
495516
496-
You can search in an Index directly:
517+
You can search in an index directly:
497518
```rust
498519
let results: SearchResults<Movie> = movies.search()
499520
.with_query("botman")
@@ -504,11 +525,11 @@ getting_started_search_md: |-
504525
505526
[About this SDK](https://github.com/meilisearch/meilisearch-rust/)
506527
faceted_search_update_settings_1: |-
507-
let progress: Progress = movies.set_attributes_for_faceting(["director", "genres"]).await.unwrap();
508-
faceted_search_facet_filters_1: |-
528+
let progress: Progress = movies.set_filterable_attributes(["director", "genres"]).await.unwrap();
529+
faceted_search_filter_1: |-
509530
let results: SearchResults<Movie> = movies.search()
510531
.with_query("thriller")
511-
.with_facet_filters(&[&["genres:Horror", "genres:Mystery"], &["director:Jordan Peele"]])
532+
.with_filter("(genres = Horror AND genres = Mystery) OR director = \"Jordan Peele\"")
512533
.execute()
513534
.await
514535
.unwrap();
@@ -520,19 +541,19 @@ faceted_search_facets_distribution_1: |-
520541
.await
521542
.unwrap();
522543
let genres: &HashMap<String, usize> = results.facets_distribution.unwrap().get("genres").unwrap();
523-
faceted_search_walkthrough_attributes_for_faceting_1: |-
524-
let attributes_for_faceting = [
544+
faceted_search_walkthrough_filterable_attributes_1: |-
545+
let filterable_attributes = [
525546
"director",
526547
"producer",
527548
"genres",
528549
"production_companies"
529550
];
530551
531-
let progress: Progress = movies.set_attributes_for_faceting(&attributes_for_faceting).await.unwrap();
532-
faceted_search_walkthrough_facet_filters_1: |-
552+
let progress: Progress = movies.set_filterable_attributes(&filterable_attributes).await.unwrap();
553+
faceted_search_walkthrough_filter_1: |-
533554
let results: SearchResults<Movie> = movies.search()
534555
.with_query("thriller")
535-
.with_facet_filters(&[&["genres:Horror", "genres:Mystery"], &["director:Jordan Peele"]])
556+
.with_filter("(genres = Horror AND genres = Mystery) OR director = \"Jordan Peele\"")
536557
.execute()
537558
.await
538559
.unwrap();
@@ -548,3 +569,10 @@ post_dump_1: |-
548569
client.create_dump().await.unwrap();
549570
get_dump_status_1: |-
550571
client.get_dump_status("20201101-110357260").await.unwrap();
572+
phrase_search_1: |-
573+
let results: SearchResults<Movie> = movies
574+
.search()
575+
.with_query("\"african american\" horror")
576+
.execute()
577+
.await
578+
.unwrap();

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ WARNING: `meilisearch-sdk` will panic if no Window is available (ex: Web extensi
140140

141141
## 🤖 Compatibility with MeiliSearch
142142

143-
This package only guarantees the compatibility with the [version v0.20.0 of MeiliSearch](https://github.com/meilisearch/MeiliSearch/releases/tag/v0.20.0).
143+
This package only guarantees the compatibility with the [version v0.21.0 of MeiliSearch](https://github.com/meilisearch/MeiliSearch/releases/tag/v0.21.0).
144144

145145
## ⚙️ Development Workflow and Contributing
146146

README.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ See our [Documentation](https://docs.meilisearch.com/learn/tutorials/getting_sta
4747

4848
## 🤖 Compatibility with MeiliSearch
4949

50-
This package only guarantees the compatibility with the [version v0.20.0 of MeiliSearch](https://github.com/meilisearch/MeiliSearch/releases/tag/v0.20.0).
50+
This package only guarantees the compatibility with the [version v0.21.0 of MeiliSearch](https://github.com/meilisearch/MeiliSearch/releases/tag/v0.21.0).
5151

5252
## ⚙️ Development Workflow and Contributing
5353

src/client.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,15 +314,15 @@ pub struct Keys {
314314
/// # use meilisearch_sdk::{client::*, indexes::*, errors::Error};
315315
/// Version {
316316
/// commit_sha: "b46889b5f0f2f8b91438a08a358ba8f05fc09fc1".to_string(),
317-
/// build_date: "2019-11-15T09:51:54.278247+00:00".to_string(),
317+
/// commit_date: "2019-11-15T09:51:54.278247+00:00".to_string(),
318318
/// pkg_version: "0.1.1".to_string(),
319319
/// };
320320
/// ```
321321
#[derive(Deserialize)]
322322
#[serde(rename_all = "camelCase")]
323323
pub struct Version {
324324
pub commit_sha: String,
325-
pub build_date: String,
325+
pub commit_date: String,
326326
pub pkg_version: String,
327327
}
328328

src/dumps.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ pub struct DumpInfo {
5959
pub uid: String,
6060
pub status: DumpStatus,
6161
pub error: Option<serde_json::Value>,
62+
pub started_at: Option<String>,
63+
#[serde(skip_serializing_if = "Option::is_none")]
64+
pub finished_at: Option<String>
6265
}
6366

6467
/// Dump related methods.\
@@ -154,5 +157,7 @@ mod tests {
154157
// Assert that the dump was successful
155158
let new_dump_info = client.get_dump_status(&dump_info.uid).await.unwrap();
156159
assert!(matches!(new_dump_info.status, DumpStatus::Done));
160+
assert!(new_dump_info.finished_at.is_some());
161+
assert!(new_dump_info.started_at.is_some());
157162
}
158163
}

0 commit comments

Comments
 (0)