mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-26 12:05:05 +08:00
Merge branch 'main' into update-version-v1.4.0
This commit is contained in:
commit
af0f6f0bf0
4
Cargo.lock
generated
4
Cargo.lock
generated
@ -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",
|
||||||
|
@ -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))
|
||||||
|
@ -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"]}
|
||||||
|
@ -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),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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(),
|
||||||
|
@ -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,6 +52,7 @@ pub fn extract_vector_points<R: io::Read + io::Seek>(
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if let Some(vectors) = vectors {
|
||||||
for (i, vector) in vectors.into_iter().enumerate().take(u16::MAX as usize) {
|
for (i, vector) in vectors.into_iter().enumerate().take(u16::MAX as usize) {
|
||||||
let index = u16::try_from(i).unwrap();
|
let index = u16::try_from(i).unwrap();
|
||||||
let mut key = docid_bytes.to_vec();
|
let mut key = docid_bytes.to_vec();
|
||||||
@ -60,6 +61,7 @@ pub fn extract_vector_points<R: io::Read + io::Seek>(
|
|||||||
writer.insert(key, bytes)?;
|
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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user