From 062d17fbc0e9f9c80b234cd210bc71a912b80989 Mon Sep 17 00:00:00 2001 From: ManyTheFish Date: Wed, 13 Jul 2022 10:58:39 +0200 Subject: [PATCH] Use a milli version that compute exhaustivelly the number of hits --- Cargo.lock | 37 +++++++++++++++++++---------- meilisearch-auth/Cargo.toml | 2 +- meilisearch-lib/Cargo.toml | 2 +- meilisearch-lib/src/index/search.rs | 2 ++ 4 files changed, 28 insertions(+), 15 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1292741a5..e5fd78adb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1184,7 +1184,7 @@ dependencies = [ [[package]] name = "filter-parser" version = "0.33.4" -source = "git+https://github.com/meilisearch/milli.git?tag=v0.33.4#4fc6331cb6526c07f3137584564cfe3493fb25bd" +source = "git+https://github.com/meilisearch/milli.git?branch=main#19b2326f3dd3b85daa00cf1c752797f4b11c536b" dependencies = [ "nom", "nom_locate", @@ -1203,7 +1203,7 @@ dependencies = [ [[package]] name = "flatten-serde-json" version = "0.33.4" -source = "git+https://github.com/meilisearch/milli.git?tag=v0.33.4#4fc6331cb6526c07f3137584564cfe3493fb25bd" +source = "git+https://github.com/meilisearch/milli.git?branch=main#19b2326f3dd3b85daa00cf1c752797f4b11c536b" dependencies = [ "serde_json", ] @@ -1360,9 +1360,9 @@ dependencies = [ [[package]] name = "geoutils" -version = "0.4.1" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e006f616a407d396ace1d2ebb3f43ed73189db8b098079bd129928d7645dd1e" +checksum = "36d244a08113319b5ebcabad2b8b7925732d15eec46d7e7ac3c11734f3b7a6ad" [[package]] name = "getrandom" @@ -1714,7 +1714,7 @@ dependencies = [ [[package]] name = "json-depth-checker" version = "0.33.4" -source = "git+https://github.com/meilisearch/milli.git?tag=v0.33.4#4fc6331cb6526c07f3137584564cfe3493fb25bd" +source = "git+https://github.com/meilisearch/milli.git?branch=main#19b2326f3dd3b85daa00cf1c752797f4b11c536b" dependencies = [ "serde_json", ] @@ -2195,7 +2195,7 @@ dependencies = [ "rayon", "regex", "reqwest", - "roaring", + "roaring 0.9.0", "rustls", "serde", "serde_json", @@ -2250,11 +2250,11 @@ dependencies = [ [[package]] name = "milli" version = "0.33.4" -source = "git+https://github.com/meilisearch/milli.git?tag=v0.33.4#4fc6331cb6526c07f3137584564cfe3493fb25bd" +source = "git+https://github.com/meilisearch/milli.git?branch=main#19b2326f3dd3b85daa00cf1c752797f4b11c536b" dependencies = [ "bimap", "bincode", - "bstr 0.2.17", + "bstr 1.0.1", "byteorder", "charabia", "concat-arrays", @@ -2278,7 +2278,7 @@ dependencies = [ "once_cell", "ordered-float", "rayon", - "roaring", + "roaring 0.10.1", "rstar", "serde", "serde_json", @@ -2506,9 +2506,9 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "ordered-float" -version = "2.10.0" +version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7940cf2ca942593318d07fcf2596cdca60a85c9e7fab408a5e21a4f9dcd40d87" +checksum = "1f74e330193f90ec45e2b257fa3ef6df087784157ac1ad2c1e71c62837b03aa7" dependencies = [ "num-traits", ] @@ -3015,9 +3015,9 @@ dependencies = [ [[package]] name = "retain_mut" -version = "0.1.9" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4389f1d5789befaf6029ebd9f7dac4af7f7e3d61b69d4f30e2ac02b57e7712b0" +checksum = "8c31b5c4033f8fdde8700e4657be2c497e7288f01515be52168c631e2e4d4086" [[package]] name = "ring" @@ -3066,6 +3066,17 @@ dependencies = [ "retain_mut", ] +[[package]] +name = "roaring" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef0fb5e826a8bde011ecae6a8539dd333884335c57ff0f003fbe27c25bbe8f71" +dependencies = [ + "bytemuck", + "byteorder", + "retain_mut", +] + [[package]] name = "rstar" version = "0.9.3" diff --git a/meilisearch-auth/Cargo.toml b/meilisearch-auth/Cargo.toml index cd2c88bdd..828203e7e 100644 --- a/meilisearch-auth/Cargo.toml +++ b/meilisearch-auth/Cargo.toml @@ -7,7 +7,7 @@ edition = "2021" enum-iterator = "1.1.2" hmac = "0.12.1" meilisearch-types = { path = "../meilisearch-types" } -milli = { git = "https://github.com/meilisearch/milli.git", tag = "v0.33.4", default-features = false } +milli = { git = "https://github.com/meilisearch/milli.git", branch = "main", default-features = false } rand = "0.8.5" serde = { version = "1.0.145", features = ["derive"] } serde_json = { version = "1.0.85", features = ["preserve_order"] } diff --git a/meilisearch-lib/Cargo.toml b/meilisearch-lib/Cargo.toml index c48a7bdf7..099c5528c 100644 --- a/meilisearch-lib/Cargo.toml +++ b/meilisearch-lib/Cargo.toml @@ -28,7 +28,7 @@ lazy_static = "1.4.0" log = "0.4.17" meilisearch-auth = { path = "../meilisearch-auth" } meilisearch-types = { path = "../meilisearch-types" } -milli = { git = "https://github.com/meilisearch/milli.git", tag = "v0.33.4", default-features = false } +milli = { git = "https://github.com/meilisearch/milli.git", branch = "main", default-features = false } mime = "0.3.16" num_cpus = "1.13.1" obkv = "0.2.0" diff --git a/meilisearch-lib/src/index/search.rs b/meilisearch-lib/src/index/search.rs index 083f64292..0089e8e12 100644 --- a/meilisearch-lib/src/index/search.rs +++ b/meilisearch-lib/src/index/search.rs @@ -148,6 +148,8 @@ impl Index { // we align that on the offset too. let is_finite_pagination = query.offset.is_none() && query.limit.is_none(); + search.exhaustive_number_hits(is_finite_pagination); + let (offset, limit) = if is_finite_pagination { // we start at least at page 1. let page = max(query.page, 1);