Skip to content

Commit f3ad0e2

Browse files
authored
Merge branch 'facet-search' into issue-503
2 parents 6643bc7 + 90a153c commit f3ad0e2

File tree

18 files changed

+1120
-170
lines changed

18 files changed

+1120
-170
lines changed

.code-samples.meilisearch.yaml

Lines changed: 156 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,8 @@ update_settings_1: |-
337337
"release_date"
338338
])
339339
.with_synonyms(synonyms)
340-
.with_typo_tolerance(typo_tolerance);
340+
.with_typo_tolerance(typo_tolerance)
341+
.with_search_cutoff(150);
341342
342343
let task: TaskInfo = client
343344
.index("movies")
@@ -595,6 +596,42 @@ reset_faceting_settings_1: |-
595596
.reset_faceting()
596597
.await
597598
.unwrap();
599+
get_separator_tokens_1: |-
600+
let task: TaskInfo = client
601+
.index('articles')
602+
.get_separator_tokens()
603+
.await
604+
.unwrap();
605+
update_separator_tokens_1: |-
606+
let task: TaskInfo = client
607+
.index('articles')
608+
.set_separator_tokens(&vec!['|'.to_string(), '…'.to_string()])
609+
.await
610+
.unwrap();
611+
reset_separator_tokens_1: |-
612+
let task: TaskInfo = client
613+
.index('articles')
614+
.reset_separator_tokens()
615+
.await
616+
.unwrap();
617+
get_non_separator_tokens_1: |-
618+
let task: TaskInfo = client
619+
.index('articles')
620+
.get_non_separator_tokens()
621+
.await
622+
.unwrap();
623+
update_non_separator_tokens_1: |-
624+
let task: TaskInfo = client
625+
.index('articles')
626+
.set_non_separator_tokens(&vec!['@'.to_string(), '#'.to_string()])
627+
.await
628+
.unwrap();
629+
reset_non_separator_tokens_1: |-
630+
let task: TaskInfo = client
631+
.index('articles')
632+
.reset_non_separator_tokens()
633+
.await
634+
.unwrap();
598635
get_dictionary_1: |-
599636
let task: TaskInfo = client
600637
.index('books')
@@ -839,6 +876,15 @@ search_parameter_guide_show_ranking_score_1: |-
839876
.execute()
840877
.await
841878
.unwrap();
879+
search_parameter_guide_show_ranking_score_details_1: |-
880+
let results: SearchResults<Movie> = client
881+
.index("movies")
882+
.search()
883+
.with_query("dragon")
884+
.with_show_ranking_score_details(true)
885+
.execute()
886+
.await
887+
.unwrap();
842888
search_parameter_guide_matching_strategy_1: |-
843889
let results: SearchResults<Movie> = client
844890
.index("movies")
@@ -857,6 +903,15 @@ search_parameter_guide_matching_strategy_2: |-
857903
.execute()
858904
.await
859905
.unwrap();
906+
search_parameter_guide_matching_strategy_3: |-
907+
let results: SearchResults<Movie> = client
908+
.index("movies")
909+
.search()
910+
.with_query("white shirt")
911+
.with_matching_strategy(MatchingStrategies::FREQUENCY)
912+
.execute()
913+
.await
914+
.unwrap();
860915
search_parameter_guide_hitsperpage_1: |-
861916
client.index("movies").search().with_hits_per_page(15).execute().await?;
862917
search_parameter_guide_page_1: |-
@@ -990,10 +1045,10 @@ primary_field_guide_add_document_primary_key: |-
9901045
], Some("reference_number"))
9911046
.await
9921047
.unwrap();
993-
getting_started_add_documents_md: |-
994-
```toml
1048+
getting_started_add_documents: |-
1049+
// In your .toml file:
9951050
[dependencies]
996-
meilisearch-sdk = "0.26.1"
1051+
meilisearch-sdk = "0.28.0"
9971052
# futures: because we want to block on futures
9981053
futures = "0.3"
9991054
# serde: required if you are going to use documents
@@ -1002,9 +1057,8 @@ getting_started_add_documents_md: |-
10021057
serde_json = "1.0"
10031058
```
10041059
1005-
Documents in the Rust library are strongly typed.
1006-
1007-
```rust
1060+
// In your .rs file:
1061+
// Documents in the Rust library are strongly typed
10081062
#[derive(Serialize, Deserialize)]
10091063
struct Movie {
10101064
id: i64,
@@ -1014,23 +1068,17 @@ getting_started_add_documents_md: |-
10141068
release_date: i64,
10151069
genres: Vec<String>
10161070
}
1017-
```
10181071
1019-
You will often need this `Movie` struct in other parts of this documentation. (you will have to change it a bit sometimes)
1020-
You can also use schemaless values, by putting a `serde_json::Value` inside your own struct like this:
1021-
1022-
```rust
1072+
// You will often need this `Movie` struct in other parts of this documentation. (you will have to change it a bit sometimes)
1073+
// You can also use schemaless values, by putting a `serde_json::Value` inside your own struct like this:
10231074
#[derive(Serialize, Deserialize)]
10241075
struct Movie {
10251076
id: i64,
10261077
#[serde(flatten)]
10271078
value: serde_json::Value,
10281079
}
1029-
```
1030-
1031-
Then, add documents into the index:
10321080
1033-
```rust
1081+
// Then, add documents into the index:
10341082
use meilisearch_sdk::{
10351083
indexes::*,
10361084
client::*,
@@ -1044,7 +1092,7 @@ getting_started_add_documents_md: |-
10441092
fn main() { block_on(async move {
10451093
let client = Client::new("http://localhost:7700", Some("aSampleMasterKey"));
10461094
1047-
// reading and parsing the file
1095+
// Reading and parsing the file
10481096
let mut file = File::open("movies.json")
10491097
.unwrap();
10501098
let mut content = String::new();
@@ -1054,19 +1102,15 @@ getting_started_add_documents_md: |-
10541102
let movies_docs: Vec<Movie> = serde_json::from_str(&content)
10551103
.unwrap();
10561104
1057-
// adding documents
1105+
// Adding documents
10581106
client
10591107
.index("movies")
10601108
.add_documents(&movies_docs, None)
10611109
.await
10621110
.unwrap();
10631111
})}
1064-
```
1065-
1066-
[About this SDK](https://github.com/meilisearch/meilisearch-rust/)
1067-
getting_started_search_md: |-
1068-
You can build a `SearchQuery` and execute it later:
1069-
```rust
1112+
getting_started_search: |-
1113+
// You can build a `SearchQuery` and execute it later:
10701114
let query: SearchQuery = SearchQuery::new(&movies)
10711115
.with_query("botman")
10721116
.build();
@@ -1076,29 +1120,22 @@ getting_started_search_md: |-
10761120
.execute_query(&query)
10771121
.await
10781122
.unwrap();
1079-
```
10801123
1081-
You can build a `SearchQuery` and execute it directly:
1082-
```rust
1124+
// You can build a `SearchQuery` and execute it directly:
10831125
let results: SearchResults<Movie> = SearchQuery::new(&movies)
10841126
.with_query("botman")
10851127
.execute()
10861128
.await
10871129
.unwrap();
1088-
```
10891130
1090-
You can search in an index directly:
1091-
```rust
1131+
// You can search in an index directly:
10921132
let results: SearchResults<Movie> = client
10931133
.index("movies")
10941134
.search()
10951135
.with_query("botman")
10961136
.execute()
10971137
.await
10981138
.unwrap();
1099-
```
1100-
1101-
[About this SDK](https://github.com/meilisearch/meilisearch-rust/)
11021139
getting_started_update_ranking_rules: |-
11031140
let ranking_rules = [
11041141
"exactness",
@@ -1594,8 +1631,8 @@ get_experimental_features_1: |-
15941631
.unwrap();
15951632
update_experimental_features_1: |-
15961633
let client = Client::new("http://localhost:7700", Some("apiKey"));
1597-
let mut features = ExperimentalFeatures::new(&client);
1598-
features.set_vector_store(true);
1634+
let features = ExperimentalFeatures::new(&client);
1635+
features.set_metrics(true)
15991636
let res = features
16001637
.update()
16011638
.await
@@ -1641,8 +1678,92 @@ facet_search_3: |-
16411678
.facet_search("genres")
16421679
.with_facet_query("c")
16431680
.execute()
1681+
get_search_cutoff_1: |-
1682+
let search_cutoff_ms: String = client
1683+
.index("movies")
1684+
.get_search_cutoff_ms()
1685+
.await
1686+
.unwrap();
1687+
update_search_cutoff_1: |-
1688+
let task: TaskInfo = client
1689+
.index("movies")
1690+
.set_search_cutoff_ms(Some(150))
1691+
.await
1692+
.unwrap();
1693+
reset_search_cutoff_1: |-
1694+
let task: TaskInfo = client
1695+
.index("movies")
1696+
.reset_search_cutoff_ms()
1697+
.await
1698+
.unwrap();
16441699
create_snapshot_1: |-
16451700
client
16461701
.create_snapshot()
16471702
.await
16481703
.unwrap();
1704+
search_parameter_reference_distinct_1: |-
1705+
let res = client
1706+
.index("INDEX_NAME")
1707+
.search()
1708+
.with_query("QUERY TERMS")
1709+
.with_distinct("ATTRIBUTE_A")
1710+
.execute()
1711+
.await
1712+
.unwrap();
1713+
distinct_attribute_guide_filterable_1: |-
1714+
let task: TaskInfo = client
1715+
.index("products")
1716+
.settings()
1717+
.set_filterable_attributes(["product_id", "sku", "url"])
1718+
.execute()
1719+
.await
1720+
.unwrap();
1721+
distinct_attribute_guide_distinct_parameter_1: |-
1722+
let res = client
1723+
.index("products")
1724+
.search()
1725+
.with_query("white shirt")
1726+
.with_distinct("sku")
1727+
.execute()
1728+
.await
1729+
.unwrap();
1730+
search_parameter_reference_ranking_score_threshold_1: |-
1731+
let res = client
1732+
.index("INDEX_NAME")
1733+
.search()
1734+
.with_query("badman")
1735+
.with_ranking_score_threshold(0.2)
1736+
.execute()
1737+
.await
1738+
.unwrap();
1739+
search_parameter_reference_locales_1: |-
1740+
let res = client
1741+
.index("books")
1742+
.search()
1743+
.with_query("進撃の巨人")
1744+
.with_locales(&["jpn"])
1745+
.execute()
1746+
.await
1747+
.unwrap();
1748+
get_localized_attribute_settings_1: |-
1749+
let localized_attributes: Option<Vec<LocalizedAttributes>> = client
1750+
.index("books")
1751+
.get_localized_attributes()
1752+
.await
1753+
.unwrap();
1754+
update_localized_attribute_settings_1: |-
1755+
let localized_attributes = vec![LocalizedAttributes {
1756+
locales: vec!["jpn".to_string()],
1757+
attribute_patterns: vec!["*_ja".to_string()],
1758+
}];
1759+
let task: TaskInfo = client
1760+
.index("books")
1761+
.set_localized_attributes(&localizced_attributes)
1762+
.await
1763+
.unwrap();
1764+
reset_localized_attribute_settings_1: |-
1765+
let task: TaskInfo = client
1766+
.index("books")
1767+
.reset_localized_attributes()
1768+
.await
1769+
.unwrap();

Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
[package]
22
name = "meilisearch-sdk"
3-
version = "0.26.1"
3+
version = "0.28.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."
77
license = "MIT"
88
readme = "README.md"
99
repository = "https://github.com/meilisearch/meilisearch-sdk"
10+
resolver = "2"
1011

1112
[workspace]
1213
members = ["examples/*"]
@@ -21,7 +22,7 @@ time = { version = "0.3.7", features = ["serde-well-known", "formatting", "parsi
2122
yaup = "0.3.1"
2223
either = { version = "1.8.0", features = ["serde"] }
2324
thiserror = "1.0.37"
24-
meilisearch-index-setting-macro = { path = "meilisearch-index-setting-macro", version = "0.26.1" }
25+
meilisearch-index-setting-macro = { path = "meilisearch-index-setting-macro", version = "0.28.0" }
2526
pin-project-lite = { version = "0.2.13", optional = true }
2627
reqwest = { version = "0.12.3", optional = true, default-features = false, features = ["rustls-tls", "http2", "stream"] }
2728
bytes = { version = "1.6", optional = true }

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2020-2024 Meili SAS
3+
Copyright (c) 2020-2025 Meili SAS
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
## Table of Contents <!-- omit in TOC -->
3636

3737
- [📖 Documentation](#-documentation)
38-
- [⚡ Supercharge your Meilisearch experience](#-supercharge-your-meilisearch-experience)
3938
- [🔧 Installation](#-installation)
4039
- [🚀 Getting started](#-getting-started)
4140
- [🌐 Running in the Browser with WASM](#-running-in-the-browser-with-wasm)
@@ -48,17 +47,13 @@ This readme contains all the documentation you need to start using this Meilisea
4847

4948
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).
5049

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-
5550
## 🔧 Installation
5651

5752
To use `meilisearch-sdk`, add this to your `Cargo.toml`:
5853

5954
```toml
6055
[dependencies]
61-
meilisearch-sdk = "0.26.1"
56+
meilisearch-sdk = "0.28.0"
6257
```
6358

6459
The following optional dependencies may also be useful:
@@ -73,23 +68,11 @@ You can enable the `sync` feature to make most structs `Sync`. It may be a bit s
7368

7469
Using this crate is possible without [serde](https://crates.io/crates/serde), but a lot of features require serde.
7570

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 -->
8172

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).
9174

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.
9376

9477
## 🚀 Getting started
9578

0 commit comments

Comments
 (0)