Skip to content

Commit 5f406dd

Browse files
committed
final update
1 parent e551a9e commit 5f406dd

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -102,24 +102,24 @@ impl Document for Movie {
102102
}
103103

104104
fn main() { block_on(async move {
105+
// Create a client (without sending any request so that can't fail)
105106
let client = Client::new("http://localhost:7700", "masterKey");
106107

107-
// An index is where the documents are stored.
108+
// Get the index called "movies"
108109
let movies = client.get_or_create("movies").await.unwrap();
109110

110111
// Add some movies in the index
111112
movies.add_documents(&[
112-
Movie{id: 1, title: String::from("Carol"), genres: vec!["Romance", "Drama"]},
113-
Movie{id: 2, title: String::from("Wonder Woman"), genres: vec!["Action", "Adventure"]},
114-
Movie{id: 3, title: String::from("Life of Pi"), genres: vec!["Adventure", "Drama"]},
115-
Movie{id: 4, title: String::from("Mad Max"), genres: vec!["Adventure", "Science Fiction"]},
116-
Movie{id: 5, title: String::from("Moana"), genres: vec!["Fantasy", "Action"]},
117-
Movie{id: 6, title: String::from("Philadelphia"), genres: vec!["Drama"]},
113+
Movie{id: 1, title: String::from("Carol"), genres: vec!["Romance".to_string(), "Drama".to_string()]},
114+
Movie{id: 2, title: String::from("Wonder Woman"), genres: vec!["Action".to_string(), "Adventure".to_string()]},
115+
Movie{id: 3, title: String::from("Life of Pi"), genres: vec!["Adventure".to_string(), "Drama".to_string()]},
116+
Movie{id: 4, title: String::from("Mad Max"), genres: vec!["Adventure".to_string(), "Science Fiction".to_string()]},
117+
Movie{id: 5, title: String::from("Moana"), genres: vec!["Fantasy".to_string(), "Action".to_string()]},
118+
Movie{id: 6, title: String::from("Philadelphia"), genres: vec!["Drama".to_string()]},
118119
], Some("id")).await.unwrap();
119120

120-
// Search in "movies"
121-
// MeiliSearch is typo-tolerant:
122-
println!("{:?}", movies.search().with_query("carlo").execute::<Movie>().await.unwrap().hits);
121+
// Query movies (note that there is a typo)
122+
println!("{:?}", movies.search().with_query("carol").execute::<Movie>().await.unwrap().hits);
123123
})}
124124
```
125125

src/lib.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,12 @@
6565
//!
6666
//! // Add some movies in the index
6767
//! movies.add_documents(&[
68-
//! Movie{id: 1, title: String::from("Carol"), genres: vec!["Romance", "Drama"]},
69-
//! Movie{id: 2, title: String::from("Wonder Woman"), genres: vec!["Action", "Adventure"]},
70-
//! Movie{id: 3, title: String::from("Life of Pi"), genres: vec!["Adventure", "Drama"]},
71-
//! Movie{id: 4, title: String::from("Mad Max"), genres: vec!["Adventure", "Science Fiction"]},
72-
//! Movie{id: 5, title: String::from("Moana"), genres: vec!["Fantasy", "Action"]},
73-
//! Movie{id: 6, title: String::from("Philadelphia"), genres: vec!["Drama"]},
68+
//! Movie{id: 1, title: String::from("Carol"), genres: vec!["Romance".to_string(), "Drama".to_string()]},
69+
//! Movie{id: 2, title: String::from("Wonder Woman"), genres: vec!["Action".to_string(), "Adventure".to_string()]},
70+
//! Movie{id: 3, title: String::from("Life of Pi"), genres: vec!["Adventure".to_string(), "Drama".to_string()]},
71+
//! Movie{id: 4, title: String::from("Mad Max"), genres: vec!["Adventure".to_string(), "Science Fiction".to_string()]},
72+
//! Movie{id: 5, title: String::from("Moana"), genres: vec!["Fantasy".to_string(), "Action".to_string()]},
73+
//! Movie{id: 6, title: String::from("Philadelphia"), genres: vec!["Drama".to_string()]},
7474
//! ], Some("id")).await.unwrap();
7575
//!
7676
//! // Query movies (note that there is a typo)

0 commit comments

Comments
 (0)