From 49c918defa34264f4085fe24dbb2cd508a7a8103 Mon Sep 17 00:00:00 2001 From: Tamo Date: Wed, 8 Sep 2021 16:54:39 +0200 Subject: [PATCH] bump milli --- Cargo.lock | 87 ++----------------- meilisearch-http/Cargo.toml | 2 +- meilisearch-http/src/error.rs | 3 + meilisearch-http/src/index/search.rs | 7 +- .../tests/settings/get_settings.rs | 4 +- 5 files changed, 18 insertions(+), 85 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index bd17cdc0b..64bff83d2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1117,17 +1117,13 @@ checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" [[package]] name = "grenad" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7824d499230110f4e4a8d4fd3fd4dc15c1347fce5082e4bba82eef17f43e1ed8" +checksum = "1a7a9cc43b28a20f791b17863f34a36654fdfa50be6d0a67bb18c1e34d145f18" dependencies = [ "bytemuck", "byteorder", - "flate2", - "lz4_flex", - "snap", "tempfile", - "zstd", ] [[package]] @@ -1352,15 +1348,6 @@ version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68f2d64f2edebec4ce84ad108148e67e1064789bee435edc5b60ad398714a3a9" -[[package]] -name = "itertools" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b" -dependencies = [ - "either", -] - [[package]] name = "itertools" version = "0.10.1" @@ -1555,15 +1542,6 @@ dependencies = [ "syn 0.15.44", ] -[[package]] -name = "lz4_flex" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5827b976d911b5d2e42b2ccfc7c0d2461a1414e8280436885218762fc529b3f8" -dependencies = [ - "twox-hash", -] - [[package]] name = "main_error" version = "0.1.1" @@ -1619,7 +1597,7 @@ dependencies = [ "hex", "http", "indexmap", - "itertools 0.10.1", + "itertools", "jemallocator", "log", "main_error", @@ -1706,8 +1684,8 @@ dependencies = [ [[package]] name = "milli" -version = "0.12.0" -source = "git+https://github.com/meilisearch/milli.git?tag=v0.12.0#5cbe8793251bbf143434c8a4c4e7195ca6c5f2ac" +version = "0.13.0" +source = "git+https://github.com/meilisearch/milli.git?tag=v0.13.0#b22aac92ace9f64e0323023d1e9bf5ed5a79e58a" dependencies = [ "bstr", "byteorder", @@ -1722,7 +1700,7 @@ dependencies = [ "grenad", "heed", "human_format", - "itertools 0.10.1", + "itertools", "levenshtein_automata", "linked-hash-map", "log", @@ -2679,12 +2657,6 @@ version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e" -[[package]] -name = "snap" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45456094d1983e2ee2a18fdfebce3189fa451699d0502cb8e3b49dba5ba41451" - [[package]] name = "socket2" version = "0.4.0" @@ -2710,12 +2682,6 @@ dependencies = [ "version_check", ] -[[package]] -name = "static_assertions" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" - [[package]] name = "stdweb" version = "0.4.20" @@ -3093,16 +3059,6 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" -[[package]] -name = "twox-hash" -version = "1.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f559b464de2e2bdabcac6a210d12e9b5a5973c251e102c44c585c71d51bd78e" -dependencies = [ - "cfg-if 1.0.0", - "static_assertions", -] - [[package]] name = "typenum" version = "1.13.0" @@ -3472,34 +3428,3 @@ dependencies = [ "thiserror", "time 0.1.44", ] - -[[package]] -name = "zstd" -version = "0.5.4+zstd.1.4.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69996ebdb1ba8b1517f61387a883857818a66c8a295f487b1ffd8fd9d2c82910" -dependencies = [ - "zstd-safe", -] - -[[package]] -name = "zstd-safe" -version = "2.0.6+zstd.1.4.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98aa931fb69ecee256d44589d19754e61851ae4769bf963b385119b1cc37a49e" -dependencies = [ - "libc", - "zstd-sys", -] - -[[package]] -name = "zstd-sys" -version = "1.4.18+zstd.1.4.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1e6e8778706838f43f771d80d37787cb2fe06dafe89dd3aebaf6721b9eaec81" -dependencies = [ - "cc", - "glob", - "itertools 0.9.0", - "libc", -] diff --git a/meilisearch-http/Cargo.toml b/meilisearch-http/Cargo.toml index aa56ad69f..dfd6cce66 100644 --- a/meilisearch-http/Cargo.toml +++ b/meilisearch-http/Cargo.toml @@ -50,7 +50,7 @@ main_error = "0.1.0" meilisearch-error = { path = "../meilisearch-error" } meilisearch-tokenizer = { git = "https://github.com/meilisearch/tokenizer.git", tag = "v0.2.5" } memmap = "0.7.0" -milli = { git = "https://github.com/meilisearch/milli.git", tag = "v0.12.0" } +milli = { git = "https://github.com/meilisearch/milli.git", tag = "v0.13.0" } mime = "0.3.16" num_cpus = "1.13.0" once_cell = "1.5.2" diff --git a/meilisearch-http/src/error.rs b/meilisearch-http/src/error.rs index 085bceabf..95a503ea4 100644 --- a/meilisearch-http/src/error.rs +++ b/meilisearch-http/src/error.rs @@ -93,14 +93,17 @@ impl ErrorCode for MilliError<'_> { | UserError::InvalidDocumentId { .. } | UserError::InvalidStoreFile | UserError::NoSpaceLeftOnDevice + | UserError::InvalidAscDescSyntax { .. } | UserError::DocumentLimitReached => Code::Internal, UserError::AttributeLimitReached => Code::MaxFieldsLimitExceeded, UserError::InvalidFilter(_) => Code::Filter, UserError::InvalidFilterAttribute(_) => Code::Filter, + UserError::InvalidSortName { .. } => Code::Sort, UserError::MissingDocumentId { .. } => Code::MissingDocumentId, UserError::MissingPrimaryKey => Code::MissingPrimaryKey, UserError::PrimaryKeyCannotBeChanged => Code::PrimaryKeyAlreadyPresent, UserError::PrimaryKeyCannotBeReset => Code::PrimaryKeyAlreadyPresent, + UserError::SortRankingRuleMissing => Code::Sort, UserError::UnknownInternalDocumentId { .. } => Code::DocumentNotFound, UserError::InvalidFacetsDistribution { .. } => Code::BadRequest, UserError::InvalidSortableAttribute { .. } => Code::Sort, diff --git a/meilisearch-http/src/index/search.rs b/meilisearch-http/src/index/search.rs index 4fd7f8cd1..26eb816a0 100644 --- a/meilisearch-http/src/index/search.rs +++ b/meilisearch-http/src/index/search.rs @@ -6,7 +6,7 @@ use either::Either; use heed::RoTxn; use indexmap::IndexMap; use meilisearch_tokenizer::{Analyzer, AnalyzerConfig, Token}; -use milli::{AscDesc, FieldId, FieldsIdsMap, FilterCondition, MatchingWords}; +use milli::{AscDesc, FieldId, FieldsIdsMap, FilterCondition, MatchingWords, UserError}; use serde::{Deserialize, Serialize}; use serde_json::Value; @@ -110,6 +110,11 @@ impl Index { if let Some(ref sort) = query.sort { let sort = match sort.iter().map(|s| AscDesc::from_str(s)).collect() { Ok(sorts) => sorts, + Err(UserError::InvalidAscDescSyntax { name }) => { + return Err(IndexError::Milli( + UserError::InvalidSortName { name }.into(), + )) + } Err(err) => return Err(IndexError::Milli(err.into())), }; diff --git a/meilisearch-http/tests/settings/get_settings.rs b/meilisearch-http/tests/settings/get_settings.rs index 3b3ab5735..c7bcd4376 100644 --- a/meilisearch-http/tests/settings/get_settings.rs +++ b/meilisearch-http/tests/settings/get_settings.rs @@ -16,9 +16,9 @@ static DEFAULT_SETTINGS_VALUES: Lazy> = Lazy::new(| json!([ "words", "typo", - "sort", "proximity", "attribute", + "sort", "exactness" ]), ); @@ -53,9 +53,9 @@ async fn get_settings() { json!([ "words", "typo", - "sort", "proximity", "attribute", + "sort", "exactness" ]) );