Skip to content

Commit 3090fee

Browse files
authored
Merge branch 'main' into meili-bot/bump-version
2 parents 3529153 + 3d177b6 commit 3090fee

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+966
-308
lines changed

.code-samples.meilisearch.yaml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This code-samples file is used by the Meilisearch documentation
22
# Every example written here will be automatically fetched by
33
# the documentation on build
4-
# You can read more on https://github.com/meilisearch/documentation/tree/master/.vuepress/code-samples
4+
# You can read more on https://github.com/meilisearch/documentation/tree/main/learn
55
---
66
synonyms_guide_1: |-
77
let mut synonyms = std::collections::HashMap::new();
@@ -1609,3 +1609,21 @@ search_parameter_guide_facet_stats_1: |-
16091609
.execute()
16101610
.await
16111611
.unwrap();
1612+
get_proximity_precision_settings_1: |-
1613+
let proximity_precision: String = client
1614+
.index("books")
1615+
.get_typo_tolerance()
1616+
.await
1617+
.unwrap();
1618+
update_proximity_precision_settings_1: |-
1619+
let task: TaskInfo = client
1620+
.index("books")
1621+
.set_proximity_precision("byAttribute".to_string())
1622+
.await
1623+
.unwrap();
1624+
reset_proximity_precision_settings_1: |-
1625+
let task: TaskInfo = client
1626+
.index("books")
1627+
.reset_proximity_precision()
1628+
.await
1629+
.unwrap();

.github/scripts/check-release.sh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
#!/bin/sh
22

33
# Checking if current tag matches the package version
4-
current_tag=$(echo $GITHUB_REF | cut -d '/' -f 3 | sed -r 's/^v//')
5-
major=$(echo $current_tag | cut -d '.' -f1)
6-
minor=$(echo $current_tag | cut -d '.' -f2)
4+
current_tag=$(echo "$GITHUB_REF" | cut -d '/' -f 3 | sed -r 's/^v//')
75

86
file1='Cargo.toml'
97
file2='README.tpl'

.github/workflows/release-drafter.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
update_release_draft:
1010
runs-on: ubuntu-latest
1111
steps:
12-
- uses: release-drafter/release-drafter@v5
12+
- uses: release-drafter/release-drafter@v6
1313
with:
1414
config-name: release-draft-template.yml
1515
env:

CONTRIBUTING.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ curl -L https://install.meilisearch.com | sh # download Meilisearch
5353
cargo test
5454
```
5555

56-
There is two kind of tests, documentation tests and unit tests.
56+
There are two kinds of tests, documentation tests and unit tests.
5757
If you need to write or read the unit tests you should consider reading this
5858
[readme](meilisearch-test-macro/README.md) about our custom testing macro.
5959

@@ -91,13 +91,13 @@ rustup update
9191

9292
Each PR should pass the format test to be accepted.
9393

94-
Run the following to fix the formating errors:
94+
Run the following to fix the formatting errors:
9595

9696
```
9797
cargo fmt
9898
```
9999

100-
and the following to test if the formating is correct:
100+
and the following to test if the formatting is correct:
101101
```
102102
cargo fmt --all -- --check
103103
```
@@ -139,7 +139,7 @@ We do not enforce any branch naming style, but please use something descriptive
139139

140140
As minimal requirements, your commit message should:
141141
- be capitalized
142-
- not finish by a dot or any other punctuation character (!,?)
142+
- not finished by a dot or any other punctuation character (!,?)
143143
- start with a verb so that we can read your commit message this way: "This commit will ...", where "..." is the commit message.
144144
e.g.: "Fix the home page button" or "Add more tests for create_index method"
145145

@@ -171,7 +171,7 @@ _[Read more about this](https://github.com/meilisearch/integration-guides/blob/m
171171

172172
### How to Publish the Release <!-- omit in toc -->
173173

174-
⚠️ Before doing anything, make sure you got through the guide about [Releasing an Integration](https://github.com/meilisearch/integration-guides/blob/main/resources/integration-release.md).
174+
⚠️ Before doing anything, make sure you get through the guide about [Releasing an Integration](https://github.com/meilisearch/integration-guides/blob/main/resources/integration-release.md).
175175

176176
Make a PR modifying the file [`Cargo.toml`](/Cargo.toml):
177177

@@ -212,4 +212,4 @@ GitHub Actions will be triggered and push the package to [crates.io](https://cra
212212

213213
<hr>
214214

215-
Thank you again for reading this through. We can not wait to begin to work with you if you make your way through this contributing guide ❤️
215+
Thank you again for reading this through. We cannot wait to begin to work with you if you make your way through this contributing guide ❤️

Cargo.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,12 @@ log = "0.4"
1818
serde = { version = "1.0", features = ["derive"] }
1919
serde_json = "1.0"
2020
time = { version = "0.3.7", features = ["serde-well-known", "formatting", "parsing"] }
21-
jsonwebtoken = { version = "8", default-features = false }
21+
jsonwebtoken = { version = "9", default-features = false }
2222
yaup = "0.2.0"
2323
either = { version = "1.8.0", features = ["serde"] }
2424
thiserror = "1.0.37"
2525
meilisearch-index-setting-macro = { path = "meilisearch-index-setting-macro", version = "0.25.0" }
2626

27-
2827
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
2928
futures = "0.3"
3029
futures-io = "0.3.26"
@@ -43,7 +42,6 @@ isahc-static-curl = ["isahc/static-curl"]
4342
isahc-static-ssl = ["isahc/static-ssl"]
4443

4544
[dev-dependencies]
46-
env_logger = "0.11"
4745
futures-await-test = "0.3"
4846
futures = "0.3"
4947
mockito = "1.0.0"

examples/cli-app/assets/clothes.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,74 @@
11
[
22
{
33
"id": 1,
4-
"seaon": "winter",
4+
"season": "winter",
55
"article": "sweater",
66
"cost": 63.40,
77
"size":"L",
88
"pattern":"striped"
99
},
1010
{
1111
"id": 2,
12-
"seaon": "spring",
12+
"season": "spring",
1313
"article": "sweat pants",
1414
"cost": 18.00,
1515
"size":"XXXL",
1616
"pattern":"floral"
1717
},
1818
{
1919
"id": 3,
20-
"seaon": "fall",
20+
"season": "fall",
2121
"article": "t-shirt",
2222
"cost": 1634.90,
2323
"size":"M",
2424
"pattern":"solid black"
2525
},
2626
{
2727
"id": 4,
28-
"seaon": "summer",
28+
"season": "summer",
2929
"article": "tank top",
3030
"cost": 3.40,
3131
"size":"L",
3232
"pattern":"diagonal"
3333
},
3434
{
3535
"id": 5,
36-
"seaon": "winter",
36+
"season": "winter",
3737
"article": "jeans",
3838
"cost": 4.20,
3939
"size":"XL",
4040
"pattern":"striped"
4141
},
4242
{
4343
"id": 6,
44-
"seaon": "spring",
44+
"season": "spring",
4545
"article": "sun dress",
4646
"cost": 12634.56,
4747
"size":"L",
4848
"pattern":"floral"
4949
},
5050
{
5151
"id": 7,
52-
"seaon": "fall",
52+
"season": "fall",
5353
"article": "sweatshirt",
5454
"cost": 90.80,
5555
"size":"M",
5656
"pattern":"checker"
5757
},
5858
{
5959
"id": 8,
60-
"seaon": "summer",
60+
"season": "summer",
6161
"article": "shorts",
6262
"cost": 16.34,
6363
"size":"XS",
6464
"pattern":"solid beige"
6565
},
6666
{
6767
"id": 9,
68-
"seaon": "winter",
68+
"season": "winter",
6969
"article": "jacket",
7070
"cost": 634,
7171
"size":"L",
7272
"pattern":"camo"
7373
}
74-
]
74+
]

examples/cli-app/src/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ fn main() {
3838
}
3939

4040
async fn search(query: &str) {
41-
// make the search query, which excutes and serializes hits into the
41+
// make the search query, which executes and serializes hits into the
4242
// ClothesDisplay struct
4343
let query_results = CLIENT
4444
.index("clothes")
@@ -74,7 +74,7 @@ async fn build_index() {
7474
let ranking_rules = ["words", "typo", "attribute", "exactness", "cost:asc"];
7575

7676
// create searchable attributes
77-
let searchable_attributes = ["seaon", "article", "size", "pattern"];
77+
let searchable_attributes = ["season", "article", "size", "pattern"];
7878

7979
// create the synonyms hashmap
8080
let mut synonyms = std::collections::HashMap::new();
@@ -128,7 +128,7 @@ async fn build_index() {
128128
#[derive(Serialize, Deserialize, Debug)]
129129
pub struct Clothes {
130130
id: usize,
131-
seaon: String,
131+
season: String,
132132
article: String,
133133
cost: f32,
134134
size: String,

examples/web_app/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ fn header_content(processing_time_ms: usize, link: &Scope<Model>) -> Html {
147147
{"We wrote a blog post about "}<a href="https://blog.meilisearch.com/meili-finds-rust-crates/">{"how we made this search engine available for you"}</a>{"."}<br/>
148148
{"What you are currently using is not the original front end, but a clone using "}<a href="https://github.com/meilisearch/meilisearch-rust">{"the Meilisearch Rust SDK"}</a>{" and "}<a href="https://yew.rs">{"Yew"}</a>{". The code is available "}<a href="https://github.com/meilisearch/meilisearch-rust/tree/main/examples/web_app">{"here"}</a>{"."}<br/>
149149
{"The whole design was taken from "}<a href="https://lib.rs">{"lib.rs"}</a>{" because we love it."}<br/>
150-
<br/>{"We pull new crates and crates updates every "}<em>{"10 minutes"}</em>{" from "}<a href="https://docs.rs/releases">{"docs.rs"}</a>{" and all the downloads counts "}<em>{"every day at 3:30 PM UTC"}</em>{" from "}<a href="https://crates.io/data-access">{"crates.io"}</a>{". Currently we have something like "}<em>{" 31 729 crates"}</em>{"."}<br/>
150+
<br/>{"We pull new crates and crates update every "}<em>{"10 minutes"}</em>{" from "}<a href="https://docs.rs/releases">{"docs.rs"}</a>{" and all the downloads count "}<em>{"every day at 3:30 PM UTC"}</em>{" from "}<a href="https://crates.io/data-access">{"crates.io"}</a>{". Currently we have something like "}<em>{" 31 729 crates"}</em>{"."}<br/>
151151
<br/>{"Have fun using it "}<img draggable="false" class="emoji" alt="⌨️" src="moz-extension://57a82bfe-3134-4c34-bdb1-bc4ada430e6c/data/components/twemoji/svg/2328.svg"/>{" "}<img draggable="false" class="emoji" alt="💨" src="moz-extension://57a82bfe-3134-4c34-bdb1-bc4ada430e6c/data/components/twemoji/svg/1f4a8.svg"/><br/>
152152
</p>
153153
<form role="search" id="search">
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
DATABASE_URL=postgres://[username]:[password]@localhost/[database_name]
2+
MEILISEARCH_HOST=http://localhost:7700
3+
MEILISEARCH_API_KEY=[your-master-key]
4+
MIGRATIONS_DIR_PATH=migrations

examples/web_app_graphql/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/target
2+
/Cargo.lock
3+
4+
.env

examples/web_app_graphql/Cargo.toml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
[package]
2+
name = "meilisearch-ex"
3+
version = "0.1.0"
4+
edition = "2021"
5+
authors = ["Eugene Korir <[email protected]>"]
6+
7+
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
8+
9+
[dependencies]
10+
actix-cors = "0.7.0"
11+
actix-web = "4.4.0"
12+
async-graphql = "6.0.11"
13+
async-graphql-actix-web = "6.0.11"
14+
diesel = { version = "2.1.4", features = ["postgres"] }
15+
diesel-async = { version = "0.4.1", features = ["postgres", "deadpool"] }
16+
diesel_migrations = "2.1.0"
17+
dotenvy = "0.15.7"
18+
env_logger = "0.10.1"
19+
envy = "0.4.2"
20+
futures = "0.3.29"
21+
log = "0.4.20"
22+
meilisearch-sdk = "0.24.3"
23+
serde = { version = "1.0.192", features = ["derive"] }
24+
serde_json = "1.0.108"
25+
thiserror = "1.0.51"
26+
validator = { version = "0.16.1", features = ["derive"] }

examples/web_app_graphql/README.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Meilisearch example with graphql using `diesel`, `async_graphql` and `postgres`
2+
3+
## Contents
4+
5+
Setting up a graphql server using `async_graphql` and `actix-web`
6+
7+
Using `diesel` to query the database
8+
9+
Using `meilisearch-sdk` to search for records that match a given criteria
10+
11+
## Running the example
12+
13+
The meilisearch server needs to be running. You can run it by the command below
14+
15+
```bash
16+
meilisearch --master-key <your master key>
17+
```
18+
19+
Then you can run the application by simply running
20+
21+
```bash
22+
cargo run --release
23+
```
24+
25+
The above command will display a link to your running instance and you can simply proceed by clicking the link or navigating to your browser.
26+
27+
### Running the resolvers
28+
29+
On your browser, you will see a graphql playground in which you can use to run some queries
30+
31+
You can use the `searchUsers` query as follows:
32+
33+
```gpl
34+
query {
35+
users{
36+
search(queryString: "Eugene"){
37+
lastName
38+
firstName
39+
email
40+
}
41+
}
42+
}
43+
```
44+
45+
### Errors
46+
47+
Incase you run into the following error:
48+
49+
```bash
50+
= note: ld: library not found for -lpq
51+
clang: error: linker command failed with exit code 1 (use -v to see invocation)
52+
```
53+
54+
Run:
55+
56+
```bash
57+
sudo apt install libpq-dev
58+
```
59+
60+
This should fix the error

examples/web_app_graphql/diesel.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# For documentation on how to configure this file,
2+
# see https://diesel.rs/guides/configuring-diesel-cli
3+
4+
[print_schema]
5+
file = "src/schema.rs"
6+
custom_type_derives = ["diesel::query_builder::QueryId"]
7+
8+
[migrations_directory]
9+
dir = "migrations"

examples/web_app_graphql/migrations/.keep

Whitespace-only changes.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
-- This file was automatically created by Diesel to setup helper functions
2+
-- and other internal bookkeeping. This file is safe to edit, any future
3+
-- changes will be added to existing projects as new migrations.
4+
5+
DROP FUNCTION IF EXISTS diesel_manage_updated_at(_tbl regclass);
6+
DROP FUNCTION IF EXISTS diesel_set_updated_at();
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
-- This file was automatically created by Diesel to setup helper functions
2+
-- and other internal bookkeeping. This file is safe to edit, any future
3+
-- changes will be added to existing projects as new migrations.
4+
5+
6+
7+
8+
-- Sets up a trigger for the given table to automatically set a column called
9+
-- `updated_at` whenever the row is modified (unless `updated_at` was included
10+
-- in the modified columns)
11+
--
12+
-- # Example
13+
--
14+
-- ```sql
15+
-- CREATE TABLE users (id SERIAL PRIMARY KEY, updated_at TIMESTAMP NOT NULL DEFAULT NOW());
16+
--
17+
-- SELECT diesel_manage_updated_at('users');
18+
-- ```
19+
CREATE OR REPLACE FUNCTION diesel_manage_updated_at(_tbl regclass) RETURNS VOID AS $$
20+
BEGIN
21+
EXECUTE format('CREATE TRIGGER set_updated_at BEFORE UPDATE ON %s
22+
FOR EACH ROW EXECUTE PROCEDURE diesel_set_updated_at()', _tbl);
23+
END;
24+
$$ LANGUAGE plpgsql;
25+
26+
CREATE OR REPLACE FUNCTION diesel_set_updated_at() RETURNS trigger AS $$
27+
BEGIN
28+
IF (
29+
NEW IS DISTINCT FROM OLD AND
30+
NEW.updated_at IS NOT DISTINCT FROM OLD.updated_at
31+
) THEN
32+
NEW.updated_at := current_timestamp;
33+
END IF;
34+
RETURN NEW;
35+
END;
36+
$$ LANGUAGE plpgsql;

0 commit comments

Comments
 (0)