4019: Bringing back changes from `v1.3.2` onto `main` r=irevoire a=Kerollmops



Co-authored-by: Kerollmops <clement@meilisearch.com>
Co-authored-by: meili-bors[bot] <89034592+meili-bors[bot]@users.noreply.github.com>
Co-authored-by: irevoire <irevoire@users.noreply.github.com>
Co-authored-by: Clément Renault <clement@meilisearch.com>
This commit is contained in:
meili-bors[bot] 2023-08-28 12:14:11 +00:00 committed by GitHub
commit ccf3ba3f32
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 40 additions and 36 deletions

32
Cargo.lock generated
View File

@ -468,7 +468,7 @@ checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b"
[[package]] [[package]]
name = "benchmarks" name = "benchmarks"
version = "1.3.1" version = "1.3.2"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"bytes", "bytes",
@ -699,9 +699,9 @@ dependencies = [
[[package]] [[package]]
name = "charabia" name = "charabia"
version = "0.8.2" version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57aa1b4a8dda126c03ebf2f7e31d16cfc8781c2fe80dedd1a33459efc3e07578" checksum = "098219a776307414866165a03a9cc68c1578764fe3616fe979e1c280790ddd73"
dependencies = [ dependencies = [
"aho-corasick", "aho-corasick",
"cow-utils", "cow-utils",
@ -1206,7 +1206,7 @@ dependencies = [
[[package]] [[package]]
name = "dump" name = "dump"
version = "1.3.1" version = "1.3.2"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"big_s", "big_s",
@ -1417,7 +1417,7 @@ dependencies = [
[[package]] [[package]]
name = "file-store" name = "file-store"
version = "1.3.1" version = "1.3.2"
dependencies = [ dependencies = [
"faux", "faux",
"tempfile", "tempfile",
@ -1439,7 +1439,7 @@ dependencies = [
[[package]] [[package]]
name = "filter-parser" name = "filter-parser"
version = "1.3.1" version = "1.3.2"
dependencies = [ dependencies = [
"insta", "insta",
"nom", "nom",
@ -1458,7 +1458,7 @@ dependencies = [
[[package]] [[package]]
name = "flatten-serde-json" name = "flatten-serde-json"
version = "1.3.1" version = "1.3.2"
dependencies = [ dependencies = [
"criterion", "criterion",
"serde_json", "serde_json",
@ -1576,7 +1576,7 @@ dependencies = [
[[package]] [[package]]
name = "fuzzers" name = "fuzzers"
version = "1.3.1" version = "1.3.2"
dependencies = [ dependencies = [
"arbitrary", "arbitrary",
"clap", "clap",
@ -1890,7 +1890,7 @@ dependencies = [
[[package]] [[package]]
name = "index-scheduler" name = "index-scheduler"
version = "1.3.1" version = "1.3.2"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"big_s", "big_s",
@ -2087,7 +2087,7 @@ dependencies = [
[[package]] [[package]]
name = "json-depth-checker" name = "json-depth-checker"
version = "1.3.1" version = "1.3.2"
dependencies = [ dependencies = [
"criterion", "criterion",
"serde_json", "serde_json",
@ -2499,7 +2499,7 @@ checksum = "490cc448043f947bae3cbee9c203358d62dbee0db12107a74be5c30ccfd09771"
[[package]] [[package]]
name = "meili-snap" name = "meili-snap"
version = "1.3.1" version = "1.3.2"
dependencies = [ dependencies = [
"insta", "insta",
"md5", "md5",
@ -2508,7 +2508,7 @@ dependencies = [
[[package]] [[package]]
name = "meilisearch" name = "meilisearch"
version = "1.3.1" version = "1.3.2"
dependencies = [ dependencies = [
"actix-cors", "actix-cors",
"actix-http", "actix-http",
@ -2599,7 +2599,7 @@ dependencies = [
[[package]] [[package]]
name = "meilisearch-auth" name = "meilisearch-auth"
version = "1.3.1" version = "1.3.2"
dependencies = [ dependencies = [
"base64 0.21.2", "base64 0.21.2",
"enum-iterator", "enum-iterator",
@ -2618,7 +2618,7 @@ dependencies = [
[[package]] [[package]]
name = "meilisearch-types" name = "meilisearch-types"
version = "1.3.1" version = "1.3.2"
dependencies = [ dependencies = [
"actix-web", "actix-web",
"anyhow", "anyhow",
@ -2672,7 +2672,7 @@ dependencies = [
[[package]] [[package]]
name = "milli" name = "milli"
version = "1.3.1" version = "1.3.2"
dependencies = [ dependencies = [
"big_s", "big_s",
"bimap", "bimap",
@ -2994,7 +2994,7 @@ checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94"
[[package]] [[package]]
name = "permissive-json-pointer" name = "permissive-json-pointer"
version = "1.3.1" version = "1.3.2"
dependencies = [ dependencies = [
"big_s", "big_s",
"serde_json", "serde_json",

View File

@ -18,7 +18,7 @@ members = [
] ]
[workspace.package] [workspace.package]
version = "1.3.1" version = "1.3.2"
authors = ["Quentin de Quelen <quentin@dequelen.me>", "Clément Renault <clement@meilisearch.com>"] authors = ["Quentin de Quelen <quentin@dequelen.me>", "Clément Renault <clement@meilisearch.com>"]
description = "Meilisearch HTTP server" description = "Meilisearch HTTP server"
homepage = "https://meilisearch.com" homepage = "https://meilisearch.com"

View File

@ -680,6 +680,7 @@ fn compute_semantic_score(query: &[f32], vectors: Value) -> milli::Result<Option
.map_err(InternalError::SerdeJson)?; .map_err(InternalError::SerdeJson)?;
Ok(vectors Ok(vectors
.into_iter() .into_iter()
.flatten()
.map(|v| OrderedFloat(dot_product_similarity(query, &v))) .map(|v| OrderedFloat(dot_product_similarity(query, &v)))
.max() .max()
.map(OrderedFloat::into_inner)) .map(OrderedFloat::into_inner))

View File

@ -17,7 +17,7 @@ bincode = "1.3.3"
bstr = "1.4.0" bstr = "1.4.0"
bytemuck = { version = "1.13.1", features = ["extern_crate_alloc"] } bytemuck = { version = "1.13.1", features = ["extern_crate_alloc"] }
byteorder = "1.4.3" byteorder = "1.4.3"
charabia = { version = "0.8.2", default-features = false } charabia = { version = "0.8.3", default-features = false }
concat-arrays = "0.1.2" concat-arrays = "0.1.2"
crossbeam-channel = "0.5.8" crossbeam-channel = "0.5.8"
deserr = { version = "0.6.0", features = ["actix-web"]} deserr = { version = "0.6.0", features = ["actix-web"]}

View File

@ -293,15 +293,15 @@ pub fn normalize_facet(original: &str) -> String {
#[derive(serde::Serialize, serde::Deserialize, Debug)] #[derive(serde::Serialize, serde::Deserialize, Debug)]
#[serde(transparent)] #[serde(transparent)]
pub struct VectorOrArrayOfVectors { pub struct VectorOrArrayOfVectors {
#[serde(with = "either::serde_untagged")] #[serde(with = "either::serde_untagged_optional")]
inner: either::Either<Vec<f32>, Vec<Vec<f32>>>, inner: Option<either::Either<Vec<f32>, Vec<Vec<f32>>>>,
} }
impl VectorOrArrayOfVectors { impl VectorOrArrayOfVectors {
pub fn into_array_of_vectors(self) -> Vec<Vec<f32>> { pub fn into_array_of_vectors(self) -> Option<Vec<Vec<f32>>> {
match self.inner { match self.inner? {
either::Either::Left(vector) => vec![vector], either::Either::Left(vector) => Some(vec![vector]),
either::Either::Right(vectors) => vectors, either::Either::Right(vectors) => Some(vectors),
} }
} }
} }

View File

@ -91,11 +91,12 @@ pub fn bucket_sort<'ctx, Q: RankingRuleQueryTrait>(
/// Update the universes accordingly and inform the logger. /// Update the universes accordingly and inform the logger.
macro_rules! back { macro_rules! back {
() => { () => {
assert!( // FIXME: temporarily disabled assert: see <https://github.com/meilisearch/meilisearch/pull/4013>
ranking_rule_universes[cur_ranking_rule_index].is_empty(), // assert!(
"The ranking rule {} did not sort its bucket exhaustively", // ranking_rule_universes[cur_ranking_rule_index].is_empty(),
ranking_rules[cur_ranking_rule_index].id() // "The ranking rule {} did not sort its bucket exhaustively",
); // ranking_rules[cur_ranking_rule_index].id()
// );
logger.end_iteration_ranking_rule( logger.end_iteration_ranking_rule(
cur_ranking_rule_index, cur_ranking_rule_index,
ranking_rules[cur_ranking_rule_index].as_ref(), ranking_rules[cur_ranking_rule_index].as_ref(),

View File

@ -35,7 +35,7 @@ pub fn extract_vector_points<R: io::Read + io::Seek>(
// lazily get it when needed // lazily get it when needed
let document_id = || -> Value { let document_id = || -> Value {
let document_id = obkv.get(primary_key_id).unwrap(); let document_id = obkv.get(primary_key_id).unwrap();
serde_json::from_slice(document_id).unwrap() from_slice(document_id).unwrap()
}; };
// first we retrieve the _vectors field // first we retrieve the _vectors field
@ -52,12 +52,14 @@ pub fn extract_vector_points<R: io::Read + io::Seek>(
} }
}; };
for (i, vector) in vectors.into_iter().enumerate().take(u16::MAX as usize) { if let Some(vectors) = vectors {
let index = u16::try_from(i).unwrap(); for (i, vector) in vectors.into_iter().enumerate().take(u16::MAX as usize) {
let mut key = docid_bytes.to_vec(); let index = u16::try_from(i).unwrap();
key.extend_from_slice(&index.to_be_bytes()); let mut key = docid_bytes.to_vec();
let bytes = cast_slice(&vector); key.extend_from_slice(&index.to_be_bytes());
writer.insert(key, bytes)?; let bytes = cast_slice(&vector);
writer.insert(key, bytes)?;
}
} }
} }
// else => the `_vectors` object was `null`, there is nothing to do // else => the `_vectors` object was `null`, there is nothing to do