Skip to content

Commit 414b432

Browse files
authored
Merge branch 'main' into dependabot/cargo/yew-0.20
2 parents 519b14d + 8564689 commit 414b432

File tree

28 files changed

+2085
-1127
lines changed

28 files changed

+2085
-1127
lines changed

.code-samples.meilisearch.yaml

Lines changed: 238 additions & 102 deletions
Large diffs are not rendered by default.

.github/scripts/check-release.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
current_tag=$(echo $GITHUB_REF | cut -d '/' -f 3 | sed -r 's/^v//')
55
major=$(echo $current_tag | cut -d '.' -f1)
66
minor=$(echo $current_tag | cut -d '.' -f2)
7-
cropped_current_tag="$major.$minor"
7+
88
file1='Cargo.toml'
99
file2='README.tpl'
1010
file3='.code-samples.meilisearch.yaml'
@@ -21,15 +21,15 @@ file_tag5=$(grep '^version = ' $file5 | grep -Eo '[0-9]+.[0-9]+.[0-9]+')
2121
if [ "$current_tag" != "$file_tag1" ] ||
2222
[ "$current_tag" != "$file_tag_1_1" ] ||
2323
[ "$current_tag" != "$file_tag2" ] ||
24-
[ "$cropped_current_tag" != "$file_tag3" ] ||
24+
[ "$current_tag" != "$file_tag3" ] ||
2525
[ "$current_tag" != "$file_tag4" ] ||
2626
[ "$current_tag" != "$file_tag5" ] \
2727
; then
2828
echo "Error: the current tag does not match the version in package file(s)."
2929
echo "$file1: found $file_tag1 - expected $current_tag"
3030
echo "$file1: found $file_tag_1_1 - expected $current_tag"
3131
echo "$file2: found $file_tag2 - expected $current_tag"
32-
echo "$file3: found $file_tag3 - expected $cropped_current_tag"
32+
echo "$file3: found $file_tag3 - expected $current_tag"
3333
echo "$file4: found $file_tag4 - expected $current_tag"
3434
echo "$file5: found $file_tag5 - expected $current_tag"
3535
exit 1

CONTRIBUTING.md

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ First of all, thank you for contributing to Meilisearch! The goal of this docume
1212
## Assumptions
1313

1414
1. **You're familiar with [GitHub](https://github.com) and the [Pull Request](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/about-pull-requests)(PR) workflow.**
15-
2. **You've read the Meilisearch [documentation](https://docs.meilisearch.com) and the [README](/README.md).**
16-
3. **You know about the [Meilisearch community](https://docs.meilisearch.com/learn/what_is_meilisearch/contact.html). Please use this for help.**
15+
2. **You've read the Meilisearch [documentation](https://www.meilisearch.com/docs) and the [README](/README.md).**
16+
3. **You know about the [Meilisearch community](https://discord.com/invite/meilisearch). Please use this for help.**
1717

1818
## How to Contribute
1919

@@ -175,30 +175,31 @@ Make a PR modifying the file [`Cargo.toml`](/Cargo.toml):
175175
version = "X.X.X"
176176
```
177177

178-
After the changes on `Cargo.toml`, run the following command:
178+
the [`README.tpl`](/README.tpl):
179179

180-
```
181-
sh scripts/update_macro_versions.sh
180+
```rust
181+
//! meilisearch-sdk = "X.X.X"
182182
```
183183

184-
and the [`README.tpl`](/README.tpl):
184+
and the [code-samples file](/.code-samples.meilisearch.yaml):
185185

186-
```rust
187-
//! meilisearch-sdk = "X.X.X"
186+
```yml
187+
meilisearch-sdk = "X.X.X"
188188
```
189189

190190
with the right version.
191191

192-
After the changes on `lib.rs`, run the following command:
193192

194-
```bash
195-
sh scripts/update-readme.sh
193+
After the changes on `Cargo.toml`, run the following command:
194+
195+
```
196+
sh scripts/update_macro_versions.sh
196197
```
197198

198-
You might need to change the [code-samples file](/.code-samples.meilisearch.yaml) if the minor has been upgraded:
199+
After the changes on `lib.rs`, run the following command:
199200

200-
```yml
201-
meilisearch-sdk = "X.X"
201+
```bash
202+
sh scripts/update-readme.sh
202203
```
203204

204205
Once the changes are merged on `main`, you can publish the current draft release via the [GitHub interface](https://github.com/meilisearch/meilisearch-rust/releases): on this page, click on `Edit` (related to the draft release) > update the description (be sure you apply [these recommendations](https://github.com/meilisearch/integration-guides/blob/main/resources/integration-release.md#writting-the-release-description)) > when you are ready, click on `Publish release`.

Cargo.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "meilisearch-sdk"
3-
version = "0.22.0"
3+
version = "0.24.1"
44
authors = ["Mubelotix <[email protected]>"]
55
edition = "2018"
66
description = "Rust wrapper for the Meilisearch API. Meilisearch is a powerful, fast, open-source, easy to use and deploy search engine."
@@ -13,7 +13,7 @@ members = ["examples/*"]
1313

1414
[dependencies]
1515
async-trait = "0.1.51"
16-
iso8601-duration = "0.1.0"
16+
iso8601 = "0.6.1"
1717
log = "0.4"
1818
serde = { version = "1.0", features = ["derive"] }
1919
serde_json = "1.0"
@@ -22,7 +22,7 @@ jsonwebtoken = { version = "8", default-features = false }
2222
yaup = "0.2.0"
2323
either = { version = "1.8.0", features = ["serde"] }
2424
thiserror = "1.0.37"
25-
meilisearch-index-setting-macro = { path = "meilisearch-index-setting-macro", version = "0.22.0" }
25+
meilisearch-index-setting-macro = { path = "meilisearch-index-setting-macro", version = "0.24.1" }
2626

2727

2828
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
@@ -40,6 +40,7 @@ wasm-bindgen-futures = "0.4"
4040
[features]
4141
default = ["isahc-static-curl"]
4242
isahc-static-curl = ["isahc/static-curl"]
43+
isahc-static-ssl = ["isahc/static-ssl"]
4344

4445
[dev-dependencies]
4546
env_logger = "0.10"

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,19 @@
1010

1111
<h4 align="center">
1212
<a href="https://github.com/meilisearch/meilisearch">Meilisearch</a> |
13-
<a href="https://docs.meilisearch.com">Documentation</a> |
13+
<a href="https://www.meilisearch.com/docs">Documentation</a> |
1414
<a href="https://discord.meilisearch.com">Discord</a> |
1515
<a href="https://roadmap.meilisearch.com/tabs/1-under-consideration">Roadmap</a> |
1616
<a href="https://www.meilisearch.com">Website</a> |
17-
<a href="https://docs.meilisearch.com/faq">FAQ</a>
17+
<a href="https://www.meilisearch.com/docs/faq">FAQ</a>
1818
</h4>
1919

2020
<p align="center">
2121
<a href="https://crates.io/crates/meilisearch-sdk"><img src="https://img.shields.io/crates/v/meilisearch-sdk.svg" alt="crates.io"></a>
2222
<a href="https://github.com/meilisearch/meilisearch-rust/actions"><img src="https://github.com/meilisearch/meilisearch-rust/workflows/Tests/badge.svg?branch=main" alt="Tests"></a>
2323
<a href="https://github.com/meilisearch/meilisearch-rust/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-informational" alt="License"></a>
2424
<a href="https://github.com/meilisearch/meilisearch/discussions" alt="Discussions"><img src="https://img.shields.io/badge/github-discussions-red" /></a>
25-
<a href="https://app.bors.tech/repositories/28502"><img src="https://bors.tech/images/badge_small.svg" alt="Bors enabled"></a>
25+
<a href="https://ms-bors.herokuapp.com/repositories/62"><img src="https://bors.tech/images/badge_small.svg" alt="Bors enabled"></a>
2626
</p>
2727

2828
<p align="center">⚡ The Meilisearch API client written for Rust 🦀</p>
@@ -44,15 +44,15 @@
4444

4545
This readme contains all the documentation you need to start using this Meilisearch SDK.
4646

47-
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://docs.meilisearch.com/).
47+
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).
4848

4949
## 🔧 Installation
5050

5151
To use `meilisearch-sdk`, add this to your `Cargo.toml`:
5252

5353
```toml
5454
[dependencies]
55-
meilisearch-sdk = "0.22.0"
55+
meilisearch-sdk = "0.24.1"
5656
```
5757

5858
The following optional dependencies may also be useful:
@@ -71,7 +71,7 @@ Using this crate is possible without [serde](https://crates.io/crates/serde), bu
7171

7272
This crate requires a Meilisearch server to run.
7373

74-
There are many easy ways to [download and run a Meilisearch instance](https://docs.meilisearch.com/reference/features/installation.html#download-and-launch).
74+
There are many easy ways to [download and run a Meilisearch instance](https://www.meilisearch.com/docs/learn/getting_started/installation).
7575

7676
For example,using the `curl` command in [your Terminal](https://itconnect.uw.edu/learn/workshops/online-tutorials/web-publishing/what-is-a-terminal/):
7777

@@ -104,7 +104,7 @@ struct Movie {
104104

105105
fn main() { block_on(async move {
106106
// Create a client (without sending any request so that can't fail)
107-
let client = Client::new(MEILISEARCH_URL, MEILISEARCH_API_KEY);
107+
let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY));
108108

109109
// An index is where the documents are stored.
110110
let movies = client.index("movies");
@@ -121,7 +121,7 @@ fn main() { block_on(async move {
121121
})}
122122
```
123123

124-
With the `uid`, you can check the status (`enqueued`, `processing`, `succeeded` or `failed`) of your documents addition using the [task](https://docs.meilisearch.com/reference/api/tasks.html#get-task).
124+
With the `uid`, you can check the status (`enqueued`, `processing`, `succeeded` or `failed`) of your documents addition using the [task](https://www.meilisearch.com/docs/reference/api/tasks#get-task).
125125

126126
#### Basic Search <!-- omit in TOC -->
127127

@@ -199,7 +199,7 @@ client.index("movies_4").set_filterable_attributes(&filterable_attributes).await
199199

200200
You only need to perform this operation once.
201201

202-
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://docs.meilisearch.com/reference/api/tasks.html#get-task)).
202+
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).
203203

204204
Then, you can perform the search:
205205

README.tpl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,19 @@
1010

1111
<h4 align="center">
1212
<a href="https://github.com/meilisearch/meilisearch">Meilisearch</a> |
13-
<a href="https://docs.meilisearch.com">Documentation</a> |
13+
<a href="https://www.meilisearch.com/docs">Documentation</a> |
1414
<a href="https://discord.meilisearch.com">Discord</a> |
1515
<a href="https://roadmap.meilisearch.com/tabs/1-under-consideration">Roadmap</a> |
1616
<a href="https://www.meilisearch.com">Website</a> |
17-
<a href="https://docs.meilisearch.com/faq">FAQ</a>
17+
<a href="https://www.meilisearch.com/docs/faq">FAQ</a>
1818
</h4>
1919

2020
<p align="center">
2121
<a href="https://crates.io/crates/meilisearch-sdk"><img src="https://img.shields.io/crates/v/meilisearch-sdk.svg" alt="crates.io"></a>
2222
<a href="https://github.com/meilisearch/meilisearch-rust/actions"><img src="https://github.com/meilisearch/meilisearch-rust/workflows/Tests/badge.svg?branch=main" alt="Tests"></a>
2323
<a href="https://github.com/meilisearch/meilisearch-rust/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-informational" alt="License"></a>
2424
<a href="https://github.com/meilisearch/meilisearch/discussions" alt="Discussions"><img src="https://img.shields.io/badge/github-discussions-red" /></a>
25-
<a href="https://app.bors.tech/repositories/28502"><img src="https://bors.tech/images/badge_small.svg" alt="Bors enabled"></a>
25+
<a href="https://ms-bors.herokuapp.com/repositories/62"><img src="https://bors.tech/images/badge_small.svg" alt="Bors enabled"></a>
2626
</p>
2727

2828
<p align="center">⚡ The Meilisearch API client written for Rust 🦀</p>
@@ -44,15 +44,15 @@
4444

4545
This readme contains all the documentation you need to start using this Meilisearch SDK.
4646

47-
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://docs.meilisearch.com/).
47+
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).
4848

4949
## 🔧 Installation
5050

5151
To use `meilisearch-sdk`, add this to your `Cargo.toml`:
5252

5353
```toml
5454
[dependencies]
55-
meilisearch-sdk = "0.22.0"
55+
meilisearch-sdk = "0.24.1"
5656
```
5757

5858
The following optional dependencies may also be useful:
@@ -71,7 +71,7 @@ Using this crate is possible without [serde](https://crates.io/crates/serde), bu
7171

7272
This crate requires a Meilisearch server to run.
7373

74-
There are many easy ways to [download and run a Meilisearch instance](https://docs.meilisearch.com/reference/features/installation.html#download-and-launch).
74+
There are many easy ways to [download and run a Meilisearch instance](https://www.meilisearch.com/docs/learn/getting_started/installation).
7575

7676
For example,using the `curl` command in [your Terminal](https://itconnect.uw.edu/learn/workshops/online-tutorials/web-publishing/what-is-a-terminal/):
7777

examples/cli-app/src/main.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use std::io::stdin;
77

88
// instantiate the client. load it once
99
lazy_static! {
10-
static ref CLIENT: Client = Client::new("http://localhost:7700", "masterKey");
10+
static ref CLIENT: Client = Client::new("http://localhost:7700", Some("masterKey"));
1111
}
1212

1313
fn main() {
@@ -67,13 +67,13 @@ async fn build_index() {
6767
// serialize the string to clothes objects
6868
let clothes: Vec<Clothes> = serde_json::from_str(content).unwrap();
6969

70-
//create displayed attributes
70+
// create displayed attributes
7171
let displayed_attributes = ["article", "cost", "size", "pattern"];
7272

7373
// Create ranking rules
7474
let ranking_rules = ["words", "typo", "attribute", "exactness", "cost:asc"];
7575

76-
//create searchable attributes
76+
// create searchable attributes
7777
let searchable_attributes = ["seaon", "article", "size", "pattern"];
7878

7979
// create the synonyms hashmap
@@ -82,14 +82,14 @@ async fn build_index() {
8282
synonyms.insert("sweat pants", vec!["joggers", "gym pants"]);
8383
synonyms.insert("t-shirt", vec!["tees", "tshirt"]);
8484

85-
//create the settings struct
85+
// create the settings struct
8686
let settings = Settings::new()
8787
.with_ranking_rules(ranking_rules)
8888
.with_searchable_attributes(searchable_attributes)
8989
.with_displayed_attributes(displayed_attributes)
9090
.with_synonyms(synonyms);
9191

92-
//add the settings to the index
92+
// add the settings to the index
9393
let result = CLIENT
9494
.index("clothes")
9595
.set_settings(&settings)

examples/settings.rs

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use meilisearch_sdk::settings::Settings;
55
// we need an async runtime
66
#[tokio::main(flavor = "current_thread")]
77
async fn main() {
8-
let client: Client = Client::new("http://localhost:7700", "masterKey");
8+
let client: Client = Client::new("http://localhost:7700", Some("masterKey"));
99

1010
// We try to create an index called `movies` with a primary_key of `movie_id`.
1111
let my_index: Index = client
@@ -23,7 +23,7 @@ async fn main() {
2323
.expect("An error happened with the index creation.");
2424

2525
// And now we can update the settings!
26-
// You can read more about the available options here: https://docs.meilisearch.com/learn/configuration/settings.html#index-settings
26+
// You can read more about the available options here: https://www.meilisearch.com/docs/learn/configuration/settings#index-settings
2727
let settings: Settings = Settings::new()
2828
.with_searchable_attributes(["name", "title"])
2929
.with_filterable_attributes(["created_at"]);
@@ -39,12 +39,11 @@ async fn main() {
3939
.expect("Could not join the remote server.");
4040

4141
// We check if the task failed.
42-
if task.is_failure() {
43-
panic!(
44-
"Could not update the settings. {}",
45-
task.unwrap_failure().error_message
46-
);
47-
}
42+
assert!(
43+
!task.is_failure(),
44+
"Could not update the settings. {}",
45+
task.unwrap_failure().error_message
46+
);
4847

4948
// And finally we delete the `Index`.
5049
my_index
@@ -56,10 +55,9 @@ async fn main() {
5655
.expect("Could not join the remote server.");
5756

5857
// We check if the task failed.
59-
if task.is_failure() {
60-
panic!(
61-
"Could not delete the index. {}",
62-
task.unwrap_failure().error_message
63-
);
64-
}
58+
assert!(
59+
!task.is_failure(),
60+
"Could not delete the index. {}",
61+
task.unwrap_failure().error_message
62+
);
6563
}

examples/web_app/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ crate-type = ["cdylib", "rlib"]
1212
serde_json = "1.0"
1313
wasm-bindgen = "0.2"
1414
wasm-bindgen-futures = "0.4.18"
15-
yew = "0.20"
15+
yew = {version="0.20", features = ["csr"]}
1616
meilisearch-sdk = {path="../.."}
1717
lazy_static = "1.4"
1818
serde = {version="1.0", features=["derive"]}

examples/web_app/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Build your front-end page in Rust with WebAssembly
22

33
> **Note**
4-
> It is not possible to run Meilisearch in the browser without a server. This demo uses the Rust SDK in a browser using WASM, and communicate with a Meilisearch instance that is running on a remote server.
4+
> It is not possible to run Meilisearch in the browser without a server. This demo uses the Rust SDK in a browser using WASM, and communicates with a Meilisearch instance that is running on a remote server.
55
66
This example is a clone of [crates.meilisearch.com](https://crates.meilisearch.com), but the front-end is written in Rust!
77
The Rust source files are compiled into WebAssembly and so can be readable by the browsers.

examples/web_app/src/document.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ pub struct Crate {
1313
version: String,
1414
}
1515

16-
// Implement the Document trait so that we can use our struct with Meilisearch
1716
fn get_readable_download_count(this: &Map<String, Value>) -> String {
1817
if let Some(downloads) = this["downloads"].as_f64() {
1918
if downloads < 1000.0 {
@@ -37,22 +36,22 @@ pub fn display(this: &Map<String, Value>) -> Html {
3736
url = url.replace("</em>", "");
3837

3938
html! {
40-
<li><a href=url>
39+
<li><a href={url}>
4140
<div class="h">
4241
<h4>
4342
{
4443
// This field is formatted so we don't want Yew to escape the HTML tags
45-
unescaped_html(&this["name"].as_str().unwrap_or_default())
44+
unescaped_html(this["name"].as_str().unwrap_or_default())
4645
}
4746
</h4>
48-
<p class="desc">{unescaped_html(&this["description"].as_str().unwrap_or_default())}</p>
47+
<p class="desc">{unescaped_html(this["description"].as_str().unwrap_or_default())}</p>
4948
</div>
5049
<div class="meta">
5150
<span class="version stable">
5251
<span>{"v"}</span>
5352
{&this["version"].as_str().unwrap_or_default()}
5453
</span>
55-
<span class="downloads" title=format!("{} recent downloads", this["downloads"].as_f64().unwrap_or(0.0))>
54+
<span class="downloads" title={format!("{} recent downloads", this["downloads"].as_f64().unwrap_or(0.0))}>
5655
{get_readable_download_count(this)}
5756
</span>
5857
{for this["keywords"].as_array().unwrap().iter().map(|keyword|

0 commit comments

Comments
 (0)