mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-10 23:18:55 +01:00
fix updating documents without updating the settings
This commit is contained in:
parent
e8d7c00d30
commit
633537ccd7
@ -112,27 +112,49 @@ async fn binary_quantize_before_sending_documents() {
|
|||||||
snapshot!(code, @"202 Accepted");
|
snapshot!(code, @"202 Accepted");
|
||||||
index.wait_task(value.uid()).await.succeeded();
|
index.wait_task(value.uid()).await.succeeded();
|
||||||
|
|
||||||
// Make sure the documents DB has been cleared
|
// Make sure the documents are binary quantized
|
||||||
let (documents, _code) = index
|
let (documents, _code) = index
|
||||||
.get_all_documents(GetAllDocumentsOptions { retrieve_vectors: true, ..Default::default() })
|
.get_all_documents(GetAllDocumentsOptions { retrieve_vectors: true, ..Default::default() })
|
||||||
.await;
|
.await;
|
||||||
snapshot!(json_string!(documents), @r###"
|
snapshot!(json_string!(documents), @r###"
|
||||||
{
|
{
|
||||||
"message": "internal: Invalid distance provided. Got binary quantized angular but expected angular.",
|
"results": [
|
||||||
"code": "internal",
|
|
||||||
"type": "internal",
|
|
||||||
"link": "https://docs.meilisearch.com/errors#internal"
|
|
||||||
}
|
|
||||||
"###);
|
|
||||||
|
|
||||||
// Make sure the arroy DB has been cleared
|
|
||||||
let (documents, _code) = index.search_post(json!({ "vector": [1, 1, 1] })).await;
|
|
||||||
snapshot!(documents, @r###"
|
|
||||||
{
|
{
|
||||||
"message": "internal: Invalid distance provided. Got binary quantized angular but expected angular.",
|
"id": 0,
|
||||||
"code": "internal",
|
"name": "kefir",
|
||||||
"type": "internal",
|
"_vectors": {
|
||||||
"link": "https://docs.meilisearch.com/errors#internal"
|
"manual": {
|
||||||
|
"embeddings": [
|
||||||
|
[
|
||||||
|
-1.0,
|
||||||
|
-1.0,
|
||||||
|
1.0
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"regenerate": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 1,
|
||||||
|
"name": "echo",
|
||||||
|
"_vectors": {
|
||||||
|
"manual": {
|
||||||
|
"embeddings": [
|
||||||
|
[
|
||||||
|
1.0,
|
||||||
|
1.0,
|
||||||
|
-1.0
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"regenerate": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"offset": 0,
|
||||||
|
"limit": 20,
|
||||||
|
"total": 2
|
||||||
}
|
}
|
||||||
"###);
|
"###);
|
||||||
}
|
}
|
||||||
|
@ -705,7 +705,11 @@ where
|
|||||||
InternalError::DatabaseMissingEntry { db_name: "embedder_category_id", key: None },
|
InternalError::DatabaseMissingEntry { db_name: "embedder_category_id", key: None },
|
||||||
)?;
|
)?;
|
||||||
let embedder_config = settings_diff.embedding_config_updates.get(&embedder_name);
|
let embedder_config = settings_diff.embedding_config_updates.get(&embedder_name);
|
||||||
let was_quantized = embedder_config.map_or(false, |action| action.was_quantized);
|
let was_quantized = settings_diff
|
||||||
|
.old
|
||||||
|
.embedding_configs
|
||||||
|
.get(&embedder_name)
|
||||||
|
.map_or(false, |conf| conf.2);
|
||||||
let is_quantizing = embedder_config.map_or(false, |action| action.is_being_quantized);
|
let is_quantizing = embedder_config.map_or(false, |action| action.is_being_quantized);
|
||||||
|
|
||||||
pool.install(|| {
|
pool.install(|| {
|
||||||
|
@ -668,9 +668,10 @@ pub(crate) fn write_typed_chunk_into_index(
|
|||||||
InternalError::DatabaseMissingEntry { db_name: "embedder_category_id", key: None },
|
InternalError::DatabaseMissingEntry { db_name: "embedder_category_id", key: None },
|
||||||
)?;
|
)?;
|
||||||
let binary_quantized = settings_diff
|
let binary_quantized = settings_diff
|
||||||
.embedding_config_updates
|
.old
|
||||||
|
.embedding_configs
|
||||||
.get(&embedder_name)
|
.get(&embedder_name)
|
||||||
.map_or(false, |conf| conf.was_quantized);
|
.map_or(false, |conf| conf.2);
|
||||||
// FIXME: allow customizing distance
|
// FIXME: allow customizing distance
|
||||||
let writers: Vec<_> = crate::vector::arroy_db_range_for_embedder(embedder_index)
|
let writers: Vec<_> = crate::vector::arroy_db_range_for_embedder(embedder_index)
|
||||||
.map(|k| ArroyWrapper::new(index.vector_arroy, k, binary_quantized))
|
.map(|k| ArroyWrapper::new(index.vector_arroy, k, binary_quantized))
|
||||||
|
Loading…
Reference in New Issue
Block a user