From 6a82a055d317b3d60116cef9ffd6bbd5e910ece3 Mon Sep 17 00:00:00 2001 From: ad hoc Date: Mon, 21 Mar 2022 10:51:31 +0100 Subject: [PATCH 01/10] chore(auth): refactor token validation --- .../src/extractors/authentication/mod.rs | 57 ++++++++++--------- 1 file changed, 29 insertions(+), 28 deletions(-) diff --git a/meilisearch-http/src/extractors/authentication/mod.rs b/meilisearch-http/src/extractors/authentication/mod.rs index c9c35b748..dc417fdf0 100644 --- a/meilisearch-http/src/extractors/authentication/mod.rs +++ b/meilisearch-http/src/extractors/authentication/mod.rs @@ -148,6 +148,18 @@ pub mod policies { validation } + /// Extracts the key prefix used to sign the payload from the payload, without performing any validation. + fn extract_key_prefix(token: &str) -> Option { + let mut validation = tenant_token_validation(); + validation.insecure_disable_signature_validation(); + let dummy_key = DecodingKey::from_secret(b"secret"); + let token_data = decode::(token, &dummy_key, &validation).ok()?; + + // get token fields without validating it. + let Claims { api_key_prefix, .. } = token_data.claims; + Some(api_key_prefix) + } + pub struct MasterPolicy; impl Policy for MasterPolicy { @@ -205,32 +217,7 @@ pub mod policies { return None; } - let mut validation = tenant_token_validation(); - validation.insecure_disable_signature_validation(); - let dummy_key = DecodingKey::from_secret(b"secret"); - let token_data = decode::(token, &dummy_key, &validation).ok()?; - - // get token fields without validating it. - let Claims { - search_rules, - exp, - api_key_prefix, - } = token_data.claims; - - // Check index access if an index restriction is provided. - if let Some(index) = index { - if !search_rules.is_index_authorized(index) { - return None; - } - } - - // Check if token is expired. - if let Some(exp) = exp { - if OffsetDateTime::now_utc().unix_timestamp() > exp { - return None; - } - } - + let api_key_prefix = extract_key_prefix(token)?; // check if parent key is authorized to do the action. if auth .is_key_authorized(api_key_prefix.as_bytes(), Action::Search, index) @@ -238,15 +225,29 @@ pub mod policies { { // Check if tenant token is valid. let key = auth.generate_key(&api_key_prefix)?; - decode::( + let data = decode::( token, &DecodingKey::from_secret(key.as_bytes()), &tenant_token_validation(), ) .ok()?; + // Check index access if an index restriction is provided. + if let Some(index) = index { + if !data.claims.search_rules.is_index_authorized(index) { + return None; + } + } + + // Check if token is expired. + if let Some(exp) = data.claims.exp { + if OffsetDateTime::now_utc().unix_timestamp() > exp { + return None; + } + } + return auth - .get_key_filters(api_key_prefix, Some(search_rules)) + .get_key_filters(api_key_prefix, Some(data.claims.search_rules)) .ok(); } From 4e3b20ed73ecbe725a633a808317070b19d04db4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9mentine=20Urquizar=20-=20curqui?= Date: Thu, 24 Mar 2022 12:13:30 +0100 Subject: [PATCH 02/10] Update config.yml --- .github/ISSUE_TEMPLATE/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 4997861fb..0a5835b86 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1,7 +1,7 @@ contact_links: - - name: Feature request + - name: Feature request & feedback url: https://github.com/meilisearch/product/discussions/categories/feedback-feature-proposal - about: The feature requests are not managed in this repository, please open a discussion in our dedicated product repository + about: The feature requests and feedback regarding the already existing features are not managed in this repository. Please open a discussion in our dedicated product repository - name: Documentation issue url: https://github.com/meilisearch/documentation/issues/new about: For documentation issues, open an issue or a PR in the documentation repository From ee6be4f6b96fd0ec42f3248c511eabdc70e81c5b Mon Sep 17 00:00:00 2001 From: Kerollmops Date: Thu, 24 Mar 2022 14:44:52 +0100 Subject: [PATCH 03/10] Import milli from meilisearch-lib in meilisearch-http --- Cargo.lock | 1 - meilisearch-http/Cargo.toml | 1 - meilisearch-http/src/helpers/env.rs | 3 ++- meilisearch-lib/src/lib.rs | 1 - 4 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 11becd56e..178cf7769 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1909,7 +1909,6 @@ dependencies = [ "meilisearch-auth", "meilisearch-error", "meilisearch-lib", - "milli", "mime", "num_cpus", "obkv", diff --git a/meilisearch-http/Cargo.toml b/meilisearch-http/Cargo.toml index 4a3b74b1f..546e414ce 100644 --- a/meilisearch-http/Cargo.toml +++ b/meilisearch-http/Cargo.toml @@ -47,7 +47,6 @@ log = "0.4.14" meilisearch-auth = { path = "../meilisearch-auth" } meilisearch-error = { path = "../meilisearch-error" } meilisearch-lib = { path = "../meilisearch-lib" } -milli = { git = "https://github.com/meilisearch/milli.git", tag = "v0.24.0" } mime = "0.3.16" num_cpus = "1.13.1" obkv = "0.2.0" diff --git a/meilisearch-http/src/helpers/env.rs b/meilisearch-http/src/helpers/env.rs index b36bdce0d..7c8237dad 100644 --- a/meilisearch-http/src/helpers/env.rs +++ b/meilisearch-http/src/helpers/env.rs @@ -1,10 +1,11 @@ +use meilisearch_lib::milli::heed::Env; use walkdir::WalkDir; pub trait EnvSizer { fn size(&self) -> u64; } -impl EnvSizer for milli::heed::Env { +impl EnvSizer for Env { fn size(&self) -> u64 { WalkDir::new(self.path()) .into_iter() diff --git a/meilisearch-lib/src/lib.rs b/meilisearch-lib/src/lib.rs index c49acfeee..b5bdd36c6 100644 --- a/meilisearch-lib/src/lib.rs +++ b/meilisearch-lib/src/lib.rs @@ -13,7 +13,6 @@ mod update_file_store; use std::path::Path; pub use index_controller::MeiliSearch; - pub use milli; mod compression; From 09212abdf7b9901bb952090b5ecdeaeeb0dcc8e9 Mon Sep 17 00:00:00 2001 From: Kerollmops Date: Thu, 24 Mar 2022 14:53:08 +0100 Subject: [PATCH 04/10] Update the cargo lock --- Cargo.lock | 171 +++++++++++++++++++++++++++-------------------------- 1 file changed, 86 insertions(+), 85 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 178cf7769..250cb37f1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -77,8 +77,8 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "465a6172cf69b960917811022d8f29bc0b7fa1398bc4f78b3c466673db1213b6" dependencies = [ - "quote 1.0.15", - "syn 1.0.88", + "quote 1.0.16", + "syn 1.0.89", ] [[package]] @@ -200,7 +200,7 @@ dependencies = [ "serde_urlencoded", "smallvec", "socket2", - "time 0.3.7", + "time 0.3.9", "url", ] @@ -212,8 +212,8 @@ checksum = "7525bedf54704abb1d469e88d7e7e9226df73778798a69cea5022d53b2ae91bc" dependencies = [ "actix-router", "proc-macro2 1.0.36", - "quote 1.0.15", - "syn 1.0.88", + "quote 1.0.16", + "syn 1.0.89", ] [[package]] @@ -331,8 +331,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "10f203db73a71dfa2fb6dd22763990fa26f3d2625a6da2da900d23b87d26be27" dependencies = [ "proc-macro2 1.0.36", - "quote 1.0.15", - "syn 1.0.88", + "quote 1.0.16", + "syn 1.0.89", ] [[package]] @@ -342,8 +342,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "061a7acccaa286c011ddc30970520b98fa40e00c9d644633fb26b5fc63a265e3" dependencies = [ "proc-macro2 1.0.36", - "quote 1.0.15", - "syn 1.0.88", + "quote 1.0.16", + "syn 1.0.89", ] [[package]] @@ -515,8 +515,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e215f8c2f9f79cb53c8335e687ffd07d5bfcb6fe5fc80723762d0be46e7cc54" dependencies = [ "proc-macro2 1.0.36", - "quote 1.0.15", - "syn 1.0.88", + "quote 1.0.16", + "syn 1.0.89", ] [[package]] @@ -563,9 +563,9 @@ dependencies = [ [[package]] name = "cargo_toml" -version = "0.11.4" +version = "0.11.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e270ef0cd868745878982f7ce470aa898d0d4bb248af67f0cf66f54617913ef" +checksum = "5809dd3e6444651fd1cdd3dbec71eca438c439a0fcc8081674a14da0afe50185" dependencies = [ "serde", "serde_derive", @@ -647,8 +647,8 @@ dependencies = [ "heck", "proc-macro-error", "proc-macro2 1.0.36", - "quote 1.0.15", - "syn 1.0.88", + "quote 1.0.16", + "syn 1.0.89", ] [[package]] @@ -658,8 +658,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1df715824eb382e34b7afb7463b0247bf41538aeba731fba05241ecdb5dc3747" dependencies = [ "proc-macro2 1.0.36", - "quote 1.0.15", - "syn 1.0.88", + "quote 1.0.16", + "syn 1.0.89", ] [[package]] @@ -675,7 +675,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94d4706de1b0fa5b132270cddffa8585166037822e260a944fe161acd137ca05" dependencies = [ "percent-encoding", - "time 0.3.7", + "time 0.3.9", "version_check", ] @@ -703,9 +703,9 @@ checksum = "79bb3adfaf5f75d24b01aee375f7555907840fa2800e5ec8fa3b9e2031830173" [[package]] name = "cpufeatures" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95059428f66df56b63431fdb4e1947ed2190586af5c5a8a8b71122bdf5a7f469" +checksum = "59a6001667ab124aebae2a495118e11d30984c3a653e99d86d58971708cf5e4b" dependencies = [ "libc", ] @@ -730,9 +730,9 @@ dependencies = [ [[package]] name = "crossbeam-channel" -version = "0.5.3" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdbfe11fe19ff083c48923cf179540e8cd0535903dc35e178a1fdeeb59aef51f" +checksum = "5aaa7bd5fb665c6864b5f963dd9097905c54125909c7aa94c9e18507cdbe6c53" dependencies = [ "cfg-if 1.0.0", "crossbeam-utils 0.8.8", @@ -831,8 +831,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" dependencies = [ "proc-macro2 1.0.36", - "quote 1.0.15", - "syn 1.0.88", + "quote 1.0.16", + "syn 1.0.89", ] [[package]] @@ -843,9 +843,9 @@ checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" dependencies = [ "convert_case", "proc-macro2 1.0.36", - "quote 1.0.15", + "quote 1.0.16", "rustc_version", - "syn 1.0.88", + "syn 1.0.89", ] [[package]] @@ -992,8 +992,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c134c37760b27a871ba422106eedbb8247da973a09e82558bf26d619c882b159" dependencies = [ "proc-macro2 1.0.36", - "quote 1.0.15", - "syn 1.0.88", + "quote 1.0.16", + "syn 1.0.89", ] [[package]] @@ -1170,8 +1170,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "33c1e13800337f4d4d7a316bf45a567dbcb6ffe087f16424852d97e97a91f512" dependencies = [ "proc-macro2 1.0.36", - "quote 1.0.15", - "syn 1.0.88", + "quote 1.0.16", + "syn 1.0.89", ] [[package]] @@ -1266,8 +1266,8 @@ checksum = "e45727250e75cc04ff2846a66397da8ef2b3db8e40e0cef4df67950a07621eb9" dependencies = [ "proc-macro-error", "proc-macro2 1.0.36", - "quote 1.0.15", - "syn 1.0.88", + "quote 1.0.16", + "syn 1.0.89", ] [[package]] @@ -1459,9 +1459,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hyper" -version = "0.14.17" +version = "0.14.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "043f0e083e9901b6cc658a77d1eb86f4fc650bbb977a4337dd63192826aa85dd" +checksum = "b26ae0a80afebe130861d90abf98e3814a4f28a4c6ffeb5ab8ebb2be311e0ef2" dependencies = [ "bytes", "futures-channel", @@ -1635,9 +1635,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.120" +version = "0.2.121" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad5c14e80759d0939d013e6ca49930e59fc53dd8e5009132f76240c179380c09" +checksum = "efaa7b300f3b5fe8eb6bf21ce3895e1751d9665086af2d64b42f19701015ff4f" [[package]] name = "libgit2-sys" @@ -1798,9 +1798,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.14" +version = "0.4.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" +checksum = "6389c490849ff5bc16be905ae24bc913a9c8892e19b2341dbc175e14c341c2b8" dependencies = [ "cfg-if 1.0.0", ] @@ -1823,8 +1823,8 @@ checksum = "10a9062912d7952c5588cc474795e0b9ee008e7e6781127945b85413d4b99d81" dependencies = [ "log", "proc-macro2 1.0.36", - "quote 1.0.15", - "syn 1.0.88", + "quote 1.0.16", + "syn 1.0.89", ] [[package]] @@ -1861,7 +1861,7 @@ dependencies = [ "serde_json", "sha2", "thiserror", - "time 0.3.7", + "time 0.3.9", ] [[package]] @@ -1937,7 +1937,7 @@ dependencies = [ "tempfile", "thiserror", "tikv-jemallocator", - "time 0.3.7", + "time 0.3.9", "tokio", "tokio-stream", "urlencoding", @@ -2000,7 +2000,7 @@ dependencies = [ "tar", "tempfile", "thiserror", - "time 0.3.7", + "time 0.3.9", "tokio", "uuid", "walkdir", @@ -2086,7 +2086,7 @@ dependencies = [ "smallstr", "smallvec", "tempfile", - "time 0.3.7", + "time 0.3.9", "uuid", ] @@ -2124,9 +2124,9 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ba42135c6a5917b9db9cd7b293e5409e1c6b041e6f9825e92e55a894c63b6f8" +checksum = "52da4364ffb0e4fe33a9841a98a3f3014fb964045ce4f7a45a398243c8d6b0c9" dependencies = [ "libc", "log", @@ -2168,8 +2168,8 @@ checksum = "79ef208208a0dea3f72221e26e904cdc6db2e481d9ade89081ddd494f1dbaa6b" dependencies = [ "cfg-if 1.0.0", "proc-macro2 1.0.36", - "quote 1.0.15", - "syn 1.0.88", + "quote 1.0.16", + "syn 1.0.89", ] [[package]] @@ -2273,9 +2273,9 @@ dependencies = [ [[package]] name = "num_threads" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c539a50b93a303167eded6e8dff5220cd39447409fb659f4cd24b1f72fe4f133" +checksum = "aba1801fb138d8e85e11d0fc70baf4fe1cdfffda7c6cd34a854905df588e5ed0" dependencies = [ "libc", ] @@ -2536,8 +2536,8 @@ checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" dependencies = [ "proc-macro-error-attr", "proc-macro2 1.0.36", - "quote 1.0.15", - "syn 1.0.88", + "quote 1.0.16", + "syn 1.0.89", "version_check", ] @@ -2548,7 +2548,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" dependencies = [ "proc-macro2 1.0.36", - "quote 1.0.15", + "quote 1.0.16", "version_check", ] @@ -2633,9 +2633,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.15" +version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "864d3e96a899863136fc6e99f3d7cae289dafe43bf2c5ac19b70df7210c0a145" +checksum = "b4af2ec4714533fcdf07e886f17025ace8b997b9ce51204ee69b6da831c3da57" dependencies = [ "proc-macro2 1.0.36", ] @@ -2715,12 +2715,13 @@ dependencies = [ [[package]] name = "redox_users" -version = "0.4.0" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "528532f3d801c87aec9def2add9ca802fe569e44a544afe633765267840abe64" +checksum = "7776223e2696f1aa4c6b0170e83212f47296a00424305117d013dfe86fb0fe55" dependencies = [ "getrandom", "redox_syscall", + "thiserror", ] [[package]] @@ -2970,7 +2971,7 @@ dependencies = [ "serde", "serde_json", "thiserror", - "time 0.3.7", + "time 0.3.9", ] [[package]] @@ -2995,8 +2996,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08597e7152fcd306f41838ed3e37be9eaeed2b61c42e2117266a554fab4662f9" dependencies = [ "proc-macro2 1.0.36", - "quote 1.0.15", - "syn 1.0.88", + "quote 1.0.16", + "syn 1.0.89", ] [[package]] @@ -3073,7 +3074,7 @@ dependencies = [ "num-bigint", "num-traits", "thiserror", - "time 0.3.7", + "time 0.3.9", ] [[package]] @@ -3162,12 +3163,12 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.88" +version = "1.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebd69e719f31e88618baa1eaa6ee2de5c9a1c004f1e9ecdb58e8352a13f20a01" +checksum = "ea297be220d52398dcc07ce15a209fce436d361735ac1db700cab3b6cdfb9f54" dependencies = [ "proc-macro2 1.0.36", - "quote 1.0.15", + "quote 1.0.16", "unicode-xid 0.2.2", ] @@ -3187,8 +3188,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" dependencies = [ "proc-macro2 1.0.36", - "quote 1.0.15", - "syn 1.0.88", + "quote 1.0.16", + "syn 1.0.89", "unicode-xid 0.2.2", ] @@ -3269,8 +3270,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aa32fd3f627f367fe16f893e2597ae3c05020f8bba2666a4e6ea73d377e5714b" dependencies = [ "proc-macro2 1.0.36", - "quote 1.0.15", - "syn 1.0.88", + "quote 1.0.16", + "syn 1.0.89", ] [[package]] @@ -3306,9 +3307,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.7" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "004cbc98f30fa233c61a38bc77e96a9106e65c88f2d3bef182ae952027e5753d" +checksum = "c2702e08a7a860f005826c6815dcac101b19b5eb330c27fe4a5928fec1d20ddd" dependencies = [ "itoa 1.0.1", "libc", @@ -3320,9 +3321,9 @@ dependencies = [ [[package]] name = "time-macros" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25eb0ca3468fc0acc11828786797f6ef9aa1555e4a211a60d64cc8e4d1be47d6" +checksum = "42657b1a6f4d817cda8e7a0ace261fe0cc946cf3a80314390b22cc61ae080792" [[package]] name = "tinyvec" @@ -3366,8 +3367,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b557f72f448c511a979e2564e55d74e6c4432fc96ff4f6241bc6bded342643b7" dependencies = [ "proc-macro2 1.0.36", - "quote 1.0.15", - "syn 1.0.88", + "quote 1.0.16", + "syn 1.0.89", ] [[package]] @@ -3382,9 +3383,9 @@ dependencies = [ [[package]] name = "tokio-rustls" -version = "0.23.2" +version = "0.23.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a27d5f2b839802bd8267fa19b0530f5a08b9c08cd417976be2a65d130fe1c11b" +checksum = "4151fda0cf2798550ad0b34bcfc9b9dcc2a9d2471c895c68f3a8818e54f2389e" dependencies = [ "rustls", "tokio", @@ -3546,9 +3547,9 @@ checksum = "68b90931029ab9b034b300b797048cf23723400aa757e8a2bfb9d748102f9821" [[package]] name = "utf8-width" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cf7d77f457ef8dfa11e4cd5933c5ddb5dc52a94664071951219a97710f0a32b" +checksum = "5190c9442dcdaf0ddd50f37420417d219ae5261bbf5db120d0f9bab996c9cba1" [[package]] name = "uuid" @@ -3579,7 +3580,7 @@ dependencies = [ "git2", "rustversion", "thiserror", - "time 0.3.7", + "time 0.3.9", ] [[package]] @@ -3650,8 +3651,8 @@ dependencies = [ "lazy_static", "log", "proc-macro2 1.0.36", - "quote 1.0.15", - "syn 1.0.88", + "quote 1.0.16", + "syn 1.0.89", "wasm-bindgen-shared", ] @@ -3673,7 +3674,7 @@ version = "0.2.79" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2f4203d69e40a52ee523b2529a773d5ffc1dc0071801c87b3d270b471b80ed01" dependencies = [ - "quote 1.0.15", + "quote 1.0.16", "wasm-bindgen-macro-support", ] @@ -3684,8 +3685,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfa8a30d46208db204854cadbb5d4baf5fcf8071ba5bf48190c3e59937962ebc" dependencies = [ "proc-macro2 1.0.36", - "quote 1.0.15", - "syn 1.0.88", + "quote 1.0.16", + "syn 1.0.89", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -3859,7 +3860,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d498dbd1fd7beb83c86709ae1c33ca50942889473473d287d56ce4770a18edfb" dependencies = [ "proc-macro2 1.0.36", - "syn 1.0.88", + "syn 1.0.89", "synstructure", ] From 3df542f07245cd90f7051a31dce36d42bfe561b2 Mon Sep 17 00:00:00 2001 From: Kerollmops Date: Thu, 24 Mar 2022 15:30:10 +0100 Subject: [PATCH 05/10] Export milli's heed from meilisearch-lib --- meilisearch-http/src/helpers/env.rs | 2 +- meilisearch-lib/src/lib.rs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/meilisearch-http/src/helpers/env.rs b/meilisearch-http/src/helpers/env.rs index 7c8237dad..b76c9c8a7 100644 --- a/meilisearch-http/src/helpers/env.rs +++ b/meilisearch-http/src/helpers/env.rs @@ -1,4 +1,4 @@ -use meilisearch_lib::milli::heed::Env; +use meilisearch_lib::heed::Env; use walkdir::WalkDir; pub trait EnvSizer { diff --git a/meilisearch-lib/src/lib.rs b/meilisearch-lib/src/lib.rs index b5bdd36c6..1161340ba 100644 --- a/meilisearch-lib/src/lib.rs +++ b/meilisearch-lib/src/lib.rs @@ -14,6 +14,7 @@ use std::path::Path; pub use index_controller::MeiliSearch; pub use milli; +pub use milli::heed; mod compression; pub mod document_formats; From 94f04e79ebdcd65d69535691a9a1c17a013c3804 Mon Sep 17 00:00:00 2001 From: Kerollmops Date: Tue, 29 Mar 2022 09:17:25 -0700 Subject: [PATCH 06/10] Bump the milli dependency to 0.24.1 --- Cargo.lock | 259 +++++++++++++++--------------------- meilisearch-auth/Cargo.toml | 2 +- meilisearch-lib/Cargo.toml | 2 +- 3 files changed, 106 insertions(+), 157 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 250cb37f1..dc6964f15 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -621,6 +621,12 @@ dependencies = [ "bincode", ] +[[package]] +name = "chunked_transfer" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fff857943da45f546682664a79488be82e69e43c1a7a2307679ab9afb3a66d2e" + [[package]] name = "clap" version = "3.1.6" @@ -679,16 +685,6 @@ dependencies = [ "version_check", ] -[[package]] -name = "core-foundation" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" -dependencies = [ - "core-foundation-sys", - "libc", -] - [[package]] name = "core-foundation-sys" version = "0.8.3" @@ -1033,7 +1029,7 @@ dependencies = [ [[package]] name = "filter-parser" version = "0.1.0" -source = "git+https://github.com/meilisearch/milli.git?tag=v0.24.0#5863afa1a568950de2928ba2d78b95aee243dad1" +source = "git+https://github.com/meilisearch/milli.git?tag=v0.24.1#e10c26e70da3a1735db452d54877da39e09d8b1a" dependencies = [ "nom", "nom_locate", @@ -1072,21 +1068,6 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" -[[package]] -name = "foreign-types" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" -dependencies = [ - "foreign-types-shared", -] - -[[package]] -name = "foreign-types-shared" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" - [[package]] name = "form_urlencoded" version = "1.0.1" @@ -1494,19 +1475,6 @@ dependencies = [ "tokio-rustls", ] -[[package]] -name = "hyper-tls" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" -dependencies = [ - "bytes", - "hyper", - "native-tls", - "tokio", - "tokio-native-tls", -] - [[package]] name = "idna" version = "0.2.3" @@ -1665,27 +1633,51 @@ dependencies = [ [[package]] name = "lindera" -version = "0.10.0" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29719eff479c5d34182dd16c708a413790106b790aa25f5e2f57ae6730715e69" +checksum = "9986e3ed230e1fb08dcfdb8f9f54ef10a403132814f7febb2353bfc3e6ffd81a" dependencies = [ "anyhow", "bincode", "byteorder", "encoding", + "lindera-cc-cedict-builder", "lindera-core", "lindera-dictionary", "lindera-ipadic", "lindera-ipadic-builder", + "lindera-ko-dic-builder", + "lindera-unidic-builder", "serde", "serde_json", + "thiserror", +] + +[[package]] +name = "lindera-cc-cedict-builder" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c23edd173ed036c28e34ca33f3f2f8f6613b431d6515efcd43b709bea999cf9" +dependencies = [ + "anyhow", + "bincode", + "byteorder", + "clap", + "csv", + "encoding", + "env_logger", + "glob", + "lindera-core", + "lindera-decompress", + "log", + "yada", ] [[package]] name = "lindera-core" -version = "0.10.0" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bc4dc99a35081246649b978d212c2c8d6b9adf8171c14bed844ad9c6475af45" +checksum = "fdf5218f8d991d5763b99a2408dad45ed696330a3f63a2e46761afa5e726c35b" dependencies = [ "anyhow", "bincode", @@ -1699,21 +1691,20 @@ dependencies = [ [[package]] name = "lindera-decompress" -version = "0.10.0" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc8e3d628f7d94c84fa864741b35172ea6b87d2a6efb37f7bca41532b952c24d" +checksum = "fe665156d30ae22a97f2f2fc71579d8b3d4d49753f13dc7502e1db6210153f6d" dependencies = [ "anyhow", - "bincode", "lzma-rs", "serde", ] [[package]] name = "lindera-dictionary" -version = "0.10.0" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "632f75733b3b366a0079ee5fb70215b706c1986dcebddfd5db95849b32e6e694" +checksum = "cb1802efa17ce73d8e766ce614c1a548a5fec471f0111baefb2f224bb228694e" dependencies = [ "anyhow", "bincode", @@ -1723,9 +1714,9 @@ dependencies = [ [[package]] name = "lindera-ipadic" -version = "0.10.0" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b71878006e14474ae3aa7265c4dc5bb9db861e42ba8df9a254e0b5c746cccbd4" +checksum = "7c15dbb09d5076cc1b1738dc130dc25ea5fe222db42ef010bc486a0ef6f573e8" dependencies = [ "bincode", "byteorder", @@ -1734,16 +1725,15 @@ dependencies = [ "lindera-core", "lindera-ipadic-builder", "once_cell", - "reqwest", "tar", - "tokio", + "ureq", ] [[package]] name = "lindera-ipadic-builder" -version = "0.10.0" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd441a227cbf9b9a9708b01e45e47fe9fde0f7cf8d10639baf59b1696cf2971f" +checksum = "2bdde8eab25444e23f0ba80b9baa17c3fae4773b3c764e57d57e948211d20837" dependencies = [ "anyhow", "bincode", @@ -1759,6 +1749,46 @@ dependencies = [ "yada", ] +[[package]] +name = "lindera-ko-dic-builder" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "551c01dec367d2db4e97bbbba97bba3f3e7704d45e3f7fd3ef5fce33f0392952" +dependencies = [ + "anyhow", + "bincode", + "byteorder", + "clap", + "csv", + "encoding", + "env_logger", + "glob", + "lindera-core", + "lindera-decompress", + "log", + "yada", +] + +[[package]] +name = "lindera-unidic-builder" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34a2c62a3942f849edf249d7cc1080ab32d621cea5bddabbfe88e7f2dfcc9e42" +dependencies = [ + "anyhow", + "bincode", + "byteorder", + "clap", + "csv", + "encoding", + "env_logger", + "glob", + "lindera-core", + "lindera-decompress", + "log", + "yada", +] + [[package]] name = "lmdb-rkv-sys" version = "0.15.0" @@ -2009,8 +2039,8 @@ dependencies = [ [[package]] name = "meilisearch-tokenizer" -version = "0.2.8" -source = "git+https://github.com/meilisearch/tokenizer.git?tag=v0.2.8#afd1097bdb389d0528fee7cd5167d0b68ca922a0" +version = "0.2.9" +source = "git+https://github.com/meilisearch/tokenizer.git?tag=v0.2.9#1dfc8ad9f5b338c39c3bc5fd5b2d0c1328314ddc" dependencies = [ "character_converter", "cow-utils", @@ -2051,8 +2081,8 @@ dependencies = [ [[package]] name = "milli" -version = "0.23.1" -source = "git+https://github.com/meilisearch/milli.git?tag=v0.24.0#5863afa1a568950de2928ba2d78b95aee243dad1" +version = "0.24.1" +source = "git+https://github.com/meilisearch/milli.git?tag=v0.24.1#e10c26e70da3a1735db452d54877da39e09d8b1a" dependencies = [ "bimap", "bincode", @@ -2172,24 +2202,6 @@ dependencies = [ "syn 1.0.89", ] -[[package]] -name = "native-tls" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48ba9f7719b5a0f42f338907614285fb5fd70e53858141f69898a1fb7203b24d" -dependencies = [ - "lazy_static", - "libc", - "log", - "openssl", - "openssl-probe", - "openssl-sys", - "schannel", - "security-framework", - "security-framework-sys", - "tempfile", -] - [[package]] name = "nelson" version = "0.1.0" @@ -2301,39 +2313,6 @@ version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "87f3e037eac156d1775da914196f0f37741a274155e34a0b7e427c35d2a2ecb9" -[[package]] -name = "openssl" -version = "0.10.38" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c7ae222234c30df141154f159066c5093ff73b63204dcda7121eb082fc56a95" -dependencies = [ - "bitflags", - "cfg-if 1.0.0", - "foreign-types", - "libc", - "once_cell", - "openssl-sys", -] - -[[package]] -name = "openssl-probe" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" - -[[package]] -name = "openssl-sys" -version = "0.9.72" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e46109c383602735fa0a2e48dd2b7c892b048e1bf69e5c3b1d804b7d9c203cb" -dependencies = [ - "autocfg", - "cc", - "libc", - "pkg-config", - "vcpkg", -] - [[package]] name = "ordered-float" version = "2.10.0" @@ -2772,13 +2751,11 @@ dependencies = [ "http-body", "hyper", "hyper-rustls", - "hyper-tls", "ipnet", "js-sys", "lazy_static", "log", "mime", - "native-tls", "percent-encoding", "pin-project-lite", "rustls", @@ -2787,7 +2764,6 @@ dependencies = [ "serde_json", "serde_urlencoded", "tokio", - "tokio-native-tls", "tokio-rustls", "url", "wasm-bindgen", @@ -2911,16 +2887,6 @@ dependencies = [ "winapi-util", ] -[[package]] -name = "schannel" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f05ba609c234e60bee0d547fe94a4c7e9da733d1c962cf6e59efa4cd9c8bc75" -dependencies = [ - "lazy_static", - "winapi", -] - [[package]] name = "scopeguard" version = "1.1.0" @@ -2937,29 +2903,6 @@ dependencies = [ "untrusted", ] -[[package]] -name = "security-framework" -version = "2.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dc14f172faf8a0194a3aded622712b0de276821addc574fa54fc0a1167e10dc" -dependencies = [ - "bitflags", - "core-foundation", - "core-foundation-sys", - "libc", - "security-framework-sys", -] - -[[package]] -name = "security-framework-sys" -version = "2.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0160a13a177a45bfb43ce71c01580998474f556ad854dcbca936dd2841a5c556" -dependencies = [ - "core-foundation-sys", - "libc", -] - [[package]] name = "segment" version = "0.2.0" @@ -3371,16 +3314,6 @@ dependencies = [ "syn 1.0.89", ] -[[package]] -name = "tokio-native-tls" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7d995660bd2b7f8c1568414c1126076c13fbb725c40112dc0120b78eb9b717b" -dependencies = [ - "native-tls", - "tokio", -] - [[package]] name = "tokio-rustls" version = "0.23.3" @@ -3527,6 +3460,22 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" +[[package]] +name = "ureq" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9399fa2f927a3d327187cbd201480cee55bee6ac5d3c77dd27f0c6814cff16d5" +dependencies = [ + "base64", + "chunked_transfer", + "log", + "once_cell", + "rustls", + "url", + "webpki", + "webpki-roots", +] + [[package]] name = "url" version = "2.2.2" diff --git a/meilisearch-auth/Cargo.toml b/meilisearch-auth/Cargo.toml index 74e4e2db9..d6d2c2424 100644 --- a/meilisearch-auth/Cargo.toml +++ b/meilisearch-auth/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" [dependencies] enum-iterator = "0.7.0" meilisearch-error = { path = "../meilisearch-error" } -milli = { git = "https://github.com/meilisearch/milli.git", tag = "v0.24.0" } +milli = { git = "https://github.com/meilisearch/milli.git", tag = "v0.24.1" } rand = "0.8.4" serde = { version = "1.0.136", features = ["derive"] } serde_json = { version = "1.0.79", features = ["preserve_order"] } diff --git a/meilisearch-lib/Cargo.toml b/meilisearch-lib/Cargo.toml index 399e7a352..57b671964 100644 --- a/meilisearch-lib/Cargo.toml +++ b/meilisearch-lib/Cargo.toml @@ -30,7 +30,7 @@ lazy_static = "1.4.0" log = "0.4.14" meilisearch-auth = { path = "../meilisearch-auth" } meilisearch-error = { path = "../meilisearch-error" } -milli = { git = "https://github.com/meilisearch/milli.git", tag = "v0.24.0" } +milli = { git = "https://github.com/meilisearch/milli.git", tag = "v0.24.1" } mime = "0.3.16" num_cpus = "1.13.1" obkv = "0.2.0" From 8fecc6238ddd60937564a4fa55cfe1642d1d62f2 Mon Sep 17 00:00:00 2001 From: Kerollmops Date: Mon, 21 Mar 2022 10:50:55 +0100 Subject: [PATCH 07/10] Make the test use the default CLI options --- meilisearch-http/tests/common/server.rs | 27 +++---------------------- meilisearch-lib/src/options.rs | 13 ------------ 2 files changed, 3 insertions(+), 37 deletions(-) diff --git a/meilisearch-http/tests/common/server.rs b/meilisearch-http/tests/common/server.rs index dcb4b6266..9a94085a4 100644 --- a/meilisearch-http/tests/common/server.rs +++ b/meilisearch-http/tests/common/server.rs @@ -1,4 +1,6 @@ #![allow(dead_code)] + +use clap::Parser; use std::path::Path; use actix_web::http::StatusCode; @@ -126,36 +128,13 @@ pub fn default_settings(dir: impl AsRef) -> Opt { Opt { db_path: dir.as_ref().join("db"), dumps_dir: dir.as_ref().join("dump"), - http_addr: "127.0.0.1:7700".to_owned(), - master_key: None, env: "development".to_owned(), #[cfg(all(not(debug_assertions), feature = "analytics"))] no_analytics: true, max_index_size: Byte::from_unit(4.0, ByteUnit::GiB).unwrap(), max_task_db_size: Byte::from_unit(4.0, ByteUnit::GiB).unwrap(), http_payload_size_limit: Byte::from_unit(10.0, ByteUnit::MiB).unwrap(), - ssl_cert_path: None, - ssl_key_path: None, - ssl_auth_path: None, - ssl_ocsp_path: None, - ssl_require_auth: false, - ssl_resumption: false, - ssl_tickets: false, - import_snapshot: None, - ignore_missing_snapshot: false, - ignore_snapshot_if_db_exists: false, snapshot_dir: ".".into(), - schedule_snapshot: false, - snapshot_interval_sec: 0, - import_dump: None, - ignore_missing_dump: false, - ignore_dump_if_db_exists: false, - indexer_options: IndexerOpts { - // memory has to be unlimited because several meilisearch are running in test context. - max_memory: MaxMemory::unlimited(), - ..Default::default() - }, - log_level: "off".into(), - scheduler_options: meilisearch_lib::options::SchedulerConfig::default(), + ..Parser::parse_from(None as Option<&str>) } } diff --git a/meilisearch-lib/src/options.rs b/meilisearch-lib/src/options.rs index 195576799..e04396627 100644 --- a/meilisearch-lib/src/options.rs +++ b/meilisearch-lib/src/options.rs @@ -90,19 +90,6 @@ impl TryFrom<&IndexerOpts> for IndexerConfig { } } -impl Default for IndexerOpts { - fn default() -> Self { - Self { - log_every_n: 100_000, - max_nb_chunks: None, - max_memory: MaxMemory::default(), - chunk_compression_type: CompressionType::None, - chunk_compression_level: None, - indexing_jobs: None, - } - } -} - /// A type used to detect the max memory available and use 2/3 of it. #[derive(Debug, Clone, Copy)] pub struct MaxMemory(Option); From acdb10a3076f07a7a22d6a40da323f0fae4e3389 Mon Sep 17 00:00:00 2001 From: Kerollmops Date: Mon, 21 Mar 2022 10:55:15 +0100 Subject: [PATCH 08/10] Remove some useless indexer options --- meilisearch-http/tests/common/server.rs | 1 - meilisearch-lib/src/options.rs | 15 +-------------- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/meilisearch-http/tests/common/server.rs b/meilisearch-http/tests/common/server.rs index 9a94085a4..7a2b0da86 100644 --- a/meilisearch-http/tests/common/server.rs +++ b/meilisearch-http/tests/common/server.rs @@ -7,7 +7,6 @@ use actix_web::http::StatusCode; use byte_unit::{Byte, ByteUnit}; use meilisearch_auth::AuthController; use meilisearch_http::setup_meilisearch; -use meilisearch_lib::options::{IndexerOpts, MaxMemory}; use once_cell::sync::Lazy; use serde_json::Value; use tempfile::TempDir; diff --git a/meilisearch-lib/src/options.rs b/meilisearch-lib/src/options.rs index e04396627..12f0c0a12 100644 --- a/meilisearch-lib/src/options.rs +++ b/meilisearch-lib/src/options.rs @@ -3,7 +3,7 @@ use std::{convert::TryFrom, ops::Deref, str::FromStr}; use byte_unit::{Byte, ByteError}; use clap::Parser; -use milli::{update::IndexerConfig, CompressionType}; +use milli::update::IndexerConfig; use serde::Serialize; use sysinfo::{RefreshKind, System, SystemExt}; @@ -28,17 +28,6 @@ pub struct IndexerOpts { #[clap(long, default_value_t)] pub max_memory: MaxMemory, - /// The name of the compression algorithm to use when compressing intermediate - /// Grenad chunks while indexing documents. - /// - /// Choosing a fast algorithm will make the indexing faster but may consume more memory. - #[clap(long, default_value = "snappy", possible_values = &["snappy", "zlib", "lz4", "lz4hc", "zstd"])] - pub chunk_compression_type: CompressionType, - - /// The level of compression of the chosen algorithm. - #[clap(long, requires = "chunk-compression-type")] - pub chunk_compression_level: Option, - /// Number of parallel jobs for indexing, defaults to # of CPUs. #[clap(long)] pub indexing_jobs: Option, @@ -81,8 +70,6 @@ impl TryFrom<&IndexerOpts> for IndexerConfig { log_every_n: Some(other.log_every_n), max_nb_chunks: other.max_nb_chunks, max_memory: (*other.max_memory).map(|b| b.get_bytes() as usize), - chunk_compression_type: other.chunk_compression_type, - chunk_compression_level: other.chunk_compression_level, thread_pool: Some(thread_pool), max_positions_per_attributes: None, ..Default::default() From b3a11e04afb849082ab9c1b734070b209e6eb07a Mon Sep 17 00:00:00 2001 From: Kerollmops Date: Tue, 22 Mar 2022 16:38:52 +0100 Subject: [PATCH 09/10] Implement Default on IndexerOpts again --- meilisearch-lib/src/options.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/meilisearch-lib/src/options.rs b/meilisearch-lib/src/options.rs index 12f0c0a12..ef91ce695 100644 --- a/meilisearch-lib/src/options.rs +++ b/meilisearch-lib/src/options.rs @@ -69,7 +69,7 @@ impl TryFrom<&IndexerOpts> for IndexerConfig { Ok(Self { log_every_n: Some(other.log_every_n), max_nb_chunks: other.max_nb_chunks, - max_memory: (*other.max_memory).map(|b| b.get_bytes() as usize), + max_memory: other.max_memory.map(|b| b.get_bytes() as usize), thread_pool: Some(thread_pool), max_positions_per_attributes: None, ..Default::default() @@ -77,6 +77,17 @@ impl TryFrom<&IndexerOpts> for IndexerConfig { } } +impl Default for IndexerOpts { + fn default() -> Self { + Self { + log_every_n: 100_000, + max_nb_chunks: None, + max_memory: MaxMemory::default(), + indexing_jobs: None, + } + } +} + /// A type used to detect the max memory available and use 2/3 of it. #[derive(Debug, Clone, Copy)] pub struct MaxMemory(Option); From 891d042164cfbe04fb8bb7018405173eb60b2eca Mon Sep 17 00:00:00 2001 From: Kerollmops Date: Mon, 21 Mar 2022 12:10:12 +0100 Subject: [PATCH 10/10] Remove the memory limit to let Windows tests pass --- meilisearch-http/tests/common/server.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/meilisearch-http/tests/common/server.rs b/meilisearch-http/tests/common/server.rs index 7a2b0da86..a1877c78e 100644 --- a/meilisearch-http/tests/common/server.rs +++ b/meilisearch-http/tests/common/server.rs @@ -7,6 +7,7 @@ use actix_web::http::StatusCode; use byte_unit::{Byte, ByteUnit}; use meilisearch_auth::AuthController; use meilisearch_http::setup_meilisearch; +use meilisearch_lib::options::{IndexerOpts, MaxMemory}; use once_cell::sync::Lazy; use serde_json::Value; use tempfile::TempDir; @@ -134,6 +135,11 @@ pub fn default_settings(dir: impl AsRef) -> Opt { max_task_db_size: Byte::from_unit(4.0, ByteUnit::GiB).unwrap(), http_payload_size_limit: Byte::from_unit(10.0, ByteUnit::MiB).unwrap(), snapshot_dir: ".".into(), + indexer_options: IndexerOpts { + // memory has to be unlimited because several meilisearch are running in test context. + max_memory: MaxMemory::unlimited(), + ..Parser::parse_from(None as Option<&str>) + }, ..Parser::parse_from(None as Option<&str>) } }