You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+3-20Lines changed: 3 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -35,7 +35,6 @@
35
35
## Table of Contents <!-- omit in TOC -->
36
36
37
37
-[📖 Documentation](#-documentation)
38
-
-[⚡ Supercharge your Meilisearch experience](#-supercharge-your-meilisearch-experience)
39
38
-[🔧 Installation](#-installation)
40
39
-[🚀 Getting started](#-getting-started)
41
40
-[🌐 Running in the Browser with WASM](#-running-in-the-browser-with-wasm)
@@ -48,10 +47,6 @@ This readme contains all the documentation you need to start using this Meilisea
48
47
49
48
For general information on how to use Meilisearch—such as our API reference, tutorials, guides, and in-depth articles—refer to our [main documentation website](https://www.meilisearch.com/docs).
50
49
51
-
## ⚡ Supercharge your Meilisearch experience
52
-
53
-
Say goodbye to server deployment and manual updates with [Meilisearch Cloud](https://www.meilisearch.com/cloud?utm_campaign=oss&utm_source=github&utm_medium=meilisearch-rust). Get started with a 14-day free trial! No credit card required.
54
-
55
50
## 🔧 Installation
56
51
57
52
To use `meilisearch-sdk`, add this to your `Cargo.toml`:
@@ -73,23 +68,11 @@ You can enable the `sync` feature to make most structs `Sync`. It may be a bit s
73
68
74
69
Using this crate is possible without [serde](https://crates.io/crates/serde), but a lot of features require serde.
75
70
76
-
### Run a Meilisearch Instance <!-- omit in TOC -->
77
-
78
-
This crate requires a Meilisearch server to run.
79
-
80
-
There are many easy ways to [download and run a Meilisearch instance](https://www.meilisearch.com/docs/learn/getting_started/installation).
71
+
### Run Meilisearch <!-- omit in toc -->
81
72
82
-
For example,using the `curl` command in [your Terminal](https://itconnect.uw.edu/learn/workshops/online-tutorials/web-publishing/what-is-a-terminal/):
83
-
84
-
```bash
85
-
# Install Meilisearch
86
-
curl -L https://install.meilisearch.com | sh
87
-
88
-
# Launch Meilisearch
89
-
./meilisearch --master-key=masterKey
90
-
```
73
+
⚡️ **Launch, scale, and streamline in minutes with Meilisearch Cloud**—no maintenance, no commitment, cancel anytime. [Try it free now](https://cloud.meilisearch.com/login?utm_campaign=oss&utm_source=github&utm_medium=meilisearch-rust).
91
74
92
-
NB: you can also download Meilisearch from **Homebrew** or **APT**.
75
+
🪨 Prefer to self-host? [Download and deploy](https://www.meilisearch.com/docs/learn/self_hosted/getting_started_with_self_hosted_meilisearch?utm_campaign=oss&utm_source=github&utm_medium=meilisearch-rust) our fast, open-source search engine on your own infrastructure.
Copy file name to clipboardExpand all lines: README.tpl
+1-158Lines changed: 1 addition & 158 deletions
Original file line number
Diff line number
Diff line change
@@ -74,164 +74,7 @@ Using this crate is possible without [serde](https://crates.io/crates/serde), bu
74
74
75
75
🪨 Prefer to self-host? [Download and deploy](https://www.meilisearch.com/docs/learn/self_hosted/getting_started_with_self_hosted_meilisearch?utm_campaign=oss&utm_source=github&utm_medium=meilisearch-rust) our fast, open-source search engine on your own infrastructure.
76
76
77
-
## 🚀 Getting started
78
-
79
-
#### Add Documents <!-- omit in TOC -->
80
-
81
-
```rust
82
-
use meilisearch_sdk::client::*;
83
-
use serde::{Serialize, Deserialize};
84
-
use futures::executor::block_on;
85
-
86
-
#[derive(Serialize, Deserialize, Debug)]
87
-
struct Movie {
88
-
id: usize,
89
-
title: String,
90
-
genres: Vec<String>,
91
-
}
92
-
93
-
94
-
#[tokio::main(flavor = "current_thread")]
95
-
async fn main() {
96
-
// Create a client (without sending any request so that can't fail)
97
-
let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY)).unwrap();
98
-
99
-
// An index is where the documents are stored.
100
-
let movies = client.index("movies");
101
-
102
-
// Add some movies in the index. If the index 'movies' does not exist, Meilisearch creates it when you first add the documents.
103
-
movies.add_documents(&[
104
-
Movie { id: 1, title: String::from("Carol"), genres: vec!["Romance".to_string(), "Drama".to_string()] },
Movie { id: 5, title: String::from("Moana"), genres: vec!["Fantasy".to_string(), "Action".to_string()] },
109
-
Movie { id: 6, title: String::from("Philadelphia"), genres: vec!["Drama".to_string()] },
110
-
], Some("id")).await.unwrap();
111
-
}
112
-
```
113
-
114
-
With the `uid`, you can check the status (`enqueued`, `canceled`, `processing`, `succeeded` or `failed`) of your documents addition using the [task](https://www.meilisearch.com/docs/reference/api/tasks#get-task).
Note that Meilisearch will rebuild your index whenever you update `filterableAttributes`. Depending on the size of your dataset, this might take time. You can track the process using the [tasks](https://www.meilisearch.com/docs/reference/api/tasks#get-task).
193
-
194
-
Then, you can perform the search:
195
-
196
-
```rust
197
-
let search_result = client.index("movies_5")
198
-
.search()
199
-
.with_query("wonder")
200
-
.with_filter("id > 1 AND genres = Action")
201
-
.execute::<Movie>()
202
-
.await
203
-
.unwrap();
204
-
println!("{:?}", search_result.hits);
205
-
```
206
-
207
-
Json output:
208
-
```json
209
-
{
210
-
"hits": [
211
-
{
212
-
"id": 2,
213
-
"title": "Wonder Woman",
214
-
"genres": ["Action", "Adventure"]
215
-
}
216
-
],
217
-
"offset": 0,
218
-
"limit": 20,
219
-
"estimatedTotalHits": 1,
220
-
"processingTimeMs": 0,
221
-
"query": "wonder"
222
-
}
223
-
```
224
-
225
-
#### Customize the `HttpClient` <!-- omit in TOC -->
226
-
227
-
By default, the SDK uses [`reqwest`](https://docs.rs/reqwest/latest/reqwest/) to make http calls.
228
-
The SDK lets you customize the http client by implementing the `HttpClient` trait yourself and
229
-
initializing the `Client` with the `new_with_client` method.
230
-
You may be interested by the `futures-unsend` feature which lets you specify a non-Send http client.
231
-
232
-
#### Wasm support <!-- omit in TOC -->
233
-
234
-
The SDK supports wasm through reqwest. You'll need to enable the `futures-unsend` feature while importing it, though.
77
+
{{readme}}
235
78
236
79
## 🌐 Running in the Browser with WASM <!-- omit in TOC -->
0 commit comments