Skip to content

Commit bf16269

Browse files
authored
Merge branch 'main' into bump-meilisearch-v0.29.0
2 parents eb18ed9 + 89d3f4a commit bf16269

File tree

12 files changed

+678
-239
lines changed

12 files changed

+678
-239
lines changed

.code-samples.meilisearch.yaml

Lines changed: 579 additions & 170 deletions
Large diffs are not rendered by default.

CONTRIBUTING.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,26 @@
22

33
First of all, thank you for contributing to Meilisearch! The goal of this document is to provide everything you need to know in order to contribute to Meilisearch and its different integrations.
44

5+
- [Hacktoberfest 2022](#hacktoberfest-2022)
56
- [Assumptions](#assumptions)
67
- [How to Contribute](#how-to-contribute)
78
- [Development Workflow](#development-workflow)
89
- [Git Guidelines](#git-guidelines)
910
- [Release Process (for internal team only)](#release-process-for-internal-team-only)
1011

1112

13+
## Hacktoberfest 2022
14+
15+
It's [Hacktoberfest month](https://hacktoberfest.com)! 🥳
16+
17+
Thanks so much for participating with Meilisearch this year!
18+
19+
1. We will follow the quality standards set by the organizers of Hacktoberfest (see detail on their [website](https://hacktoberfest.digitalocean.com/resources/qualitystandards)). Our reviewers will not consider any PR that doesn’t match that standard.
20+
2. PRs reviews will take place from Monday to Thursday, during usual working hours, CEST time. If you submit outside of these hours, there’s no need to panic; we will get around to your contribution.
21+
3. There will be no issue assignment as we don’t want people to ask to be assigned specific issues and never return, discouraging the volunteer contributors from opening a PR to fix this issue. We take the liberty to choose the PR that best fixes the issue, so we encourage you to get to it as soon as possible and do your best!
22+
23+
You can check out the longer, more complete guideline documentation [here](https://github.com/meilisearch/.github/blob/main/Hacktoberfest_2022_contributors_guidelines.md).
24+
1225
## Assumptions
1326

1427
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.**
@@ -59,7 +72,7 @@ Also, the WASM example compilation should be checked:
5972

6073
```bash
6174
rustup target add wasm32-unknown-unknown
62-
cargo check --example web_app --target wasm32-unknown-unknown --features=sync
75+
cargo check -p web_app --target wasm32-unknown-unknown
6376
```
6477

6578
Each PR should pass the tests to be accepted.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "meilisearch-sdk"
3-
version = "0.18.0"
3+
version = "0.19.0"
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."

README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,22 @@
3333

3434
## Table of Contents <!-- omit in TOC -->
3535

36+
- [🎃 Hacktoberfest](#-hacktoberfest)
3637
- [📖 Documentation](#-documentation)
3738
- [🔧 Installation](#-installation)
3839
- [🚀 Getting Started](#-getting-started)
3940
- [🌐 Running in the Browser with WASM](#-running-in-the-browser-with-wasm)
4041
- [🤖 Compatibility with Meilisearch](#-compatibility-with-meilisearch)
4142
- [⚙️ Development Workflow and Contributing](#️-development-workflow-and-contributing)
4243

44+
## 🎃 Hacktoberfest
45+
46+
It’s Hacktoberfest 2022 @Meilisearch
47+
48+
[Hacktoberfest](https://hacktoberfest.com/) is a celebration of the open-source community. This year, and for the third time in a row, Meilisearch is participating in this fantastic event.
49+
50+
You’d like to contribute? Don’t hesitate to check out our [contributing guidelines](./CONTRIBUTING.md).
51+
4352
## 📖 Documentation
4453

4554
See our [Documentation](https://docs.meilisearch.com/learn/tutorials/getting_started.html) or our [API References](https://docs.meilisearch.com/reference/api/).
@@ -50,7 +59,7 @@ To use `meilisearch-sdk`, add this to your `Cargo.toml`:
5059

5160
```toml
5261
[dependencies]
53-
meilisearch-sdk = "0.18.0"
62+
meilisearch-sdk = "0.19.0"
5463
```
5564

5665
The following optional dependencies may also be useful:

README.tpl

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,22 @@
3333

3434
## Table of Contents <!-- omit in TOC -->
3535

36+
- [🎃 Hacktoberfest](#-hacktoberfest)
3637
- [📖 Documentation](#-documentation)
3738
- [🔧 Installation](#-installation)
3839
- [🚀 Getting Started](#-getting-started)
3940
- [🌐 Running in the Browser with WASM](#-running-in-the-browser-with-wasm)
4041
- [🤖 Compatibility with Meilisearch](#-compatibility-with-meilisearch)
4142
- [⚙️ Development Workflow and Contributing](#️-development-workflow-and-contributing)
4243

44+
## 🎃 Hacktoberfest
45+
46+
It’s Hacktoberfest 2022 @Meilisearch
47+
48+
[Hacktoberfest](https://hacktoberfest.com/) is a celebration of the open-source community. This year, and for the third time in a row, Meilisearch is participating in this fantastic event.
49+
50+
You’d like to contribute? Don’t hesitate to check out our [contributing guidelines](./CONTRIBUTING.md).
51+
4352
## 📖 Documentation
4453

4554
See our [Documentation](https://docs.meilisearch.com/learn/tutorials/getting_started.html) or our [API References](https://docs.meilisearch.com/reference/api/).
@@ -50,7 +59,7 @@ To use `meilisearch-sdk`, add this to your `Cargo.toml`:
5059

5160
```toml
5261
[dependencies]
53-
meilisearch-sdk = "0.18.0"
62+
meilisearch-sdk = "0.19.0"
5463
```
5564

5665
The following optional dependencies may also be useful:

examples/web_app/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ The Rust source files are compiled into WebAssembly and so can be readable by th
1111
If you only want to check if this example compiles, you can run:
1212

1313
```console
14-
cargo build --example web_app
14+
cargo build
1515
```
1616

1717
## Building
@@ -23,7 +23,7 @@ curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
2323
```
2424

2525
```console
26-
wasm-pack build examples/web_app/ --target=web --no-typescript
26+
wasm-pack build . --target=web --no-typescript
2727
```
2828

2929
The compiled files will be stored in the `examples/web_app/pkg` folder.

examples/web_app/src/lib.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,7 @@ mod document;
1515
use crate::document::{display, Crate};
1616

1717
lazy_static! {
18-
static ref CLIENT: Client = Client::new(
19-
"https://finding-demos.meilisearch.com",
20-
"2b902cce4f868214987a9f3c7af51a69fa660d74a785bed258178b96e3480bb3",
21-
);
18+
static ref CLIENT: Client = Client::new("http://localhost:7700", "masterKey",);
2219
}
2320

2421
struct Model {

src/client.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ use crate::{
99
};
1010
use serde::Deserialize;
1111
use serde_json::{json, Value};
12-
use std::{collections::HashMap, sync::Arc, time::Duration};
12+
use std::{collections::HashMap, time::Duration};
1313
use time::OffsetDateTime;
1414

1515
/// The top-level struct of the SDK, representing a client containing [indexes](../indexes/struct.Index.html).
1616
#[derive(Debug, Clone)]
1717
pub struct Client {
18-
pub(crate) host: Arc<String>,
19-
pub(crate) api_key: Arc<String>,
18+
pub(crate) host: String,
19+
pub(crate) api_key: String,
2020
}
2121

2222
impl Client {
@@ -36,8 +36,8 @@ impl Client {
3636
/// ```
3737
pub fn new(host: impl Into<String>, api_key: impl Into<String>) -> Client {
3838
Client {
39-
host: Arc::new(host.into()),
40-
api_key: Arc::new(api_key.into()),
39+
host: host.into(),
40+
api_key: api_key.into(),
4141
}
4242
}
4343

@@ -985,7 +985,7 @@ mod tests {
985985
let key = client.create_key(key).await.unwrap();
986986
let master_key = client.api_key.clone();
987987
// this key has no right
988-
client.api_key = Arc::new(key.key.clone());
988+
client.api_key = key.key.clone();
989989
// with a wrong key
990990
let error = client.delete_key("invalid_key").await.unwrap_err();
991991
assert!(matches!(
@@ -1060,7 +1060,7 @@ mod tests {
10601060

10611061
// backup the master key for cleanup at the end of the test
10621062
let master_client = client.clone();
1063-
client.api_key = Arc::new(no_right_key.key.clone());
1063+
client.api_key = no_right_key.key.clone();
10641064

10651065
let mut key = KeyBuilder::new();
10661066
key.with_name(format!("{name}_2"));

src/indexes.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -211,17 +211,17 @@ impl Index {
211211
/// // add some documents
212212
/// # movies.add_or_replace(&[Movie{name:String::from("Interstellar"), description:String::from("Interstellar chronicles the adventures of a group of explorers who make use of a newly discovered wormhole to surpass the limitations on human space travel and conquer the vast distances involved in an interstellar voyage.")},Movie{name:String::from("Unknown"), description:String::from("Unknown")}], Some("name")).await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
213213
///
214-
/// let query = Query::new(&movies).with_query("Interstellar").with_limit(5).build();
214+
/// let query = SearchQuery::new(&movies).with_query("Interstellar").with_limit(5).build();
215215
/// let results = movies.execute_query::<Movie>(&query).await.unwrap();
216216
/// assert!(results.hits.len()>0);
217217
/// # movies.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
218218
/// # });
219219
/// ```
220220
pub async fn execute_query<T: 'static + DeserializeOwned>(
221221
&self,
222-
query: &Query<'_>,
222+
query: &SearchQuery<'_>,
223223
) -> Result<SearchResults<T>, Error> {
224-
request::<&Query, SearchResults<T>>(
224+
request::<&SearchQuery, SearchResults<T>>(
225225
&format!("{}/indexes/{}/search", self.client.host, self.uid),
226226
&self.client.api_key,
227227
Method::Post(query),
@@ -267,8 +267,8 @@ impl Index {
267267
/// # movies.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
268268
/// # });
269269
/// ```
270-
pub fn search(&self) -> Query {
271-
Query::new(self)
270+
pub fn search(&self) -> SearchQuery {
271+
SearchQuery::new(self)
272272
}
273273

274274
/// Get one [Document] using its unique id.

src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,3 +248,5 @@ pub mod tasks;
248248
mod tenant_tokens;
249249
/// Module containing utilies functions.
250250
mod utils;
251+
252+
pub use client::*;

0 commit comments

Comments
 (0)