From d05d49ffd8d4c666de5a5528145d313d0fcb2430 Mon Sep 17 00:00:00 2001 From: Louis Dureuil Date: Tue, 14 May 2024 14:14:02 +0200 Subject: [PATCH] Fix tests --- meilisearch/tests/search/mod.rs | 54 +++++++++---------- meilisearch/tests/search/multi.rs | 30 +++++------ .../src/update/index_documents/typed_chunk.rs | 2 + 3 files changed, 44 insertions(+), 42 deletions(-) diff --git a/meilisearch/tests/search/mod.rs b/meilisearch/tests/search/mod.rs index f601e2b03..771eee21b 100644 --- a/meilisearch/tests/search/mod.rs +++ b/meilisearch/tests/search/mod.rs @@ -895,9 +895,9 @@ async fn test_score_details() { "id": "166428", "_vectors": { "manual": [ - -100, - 231, - 32 + -100.0, + 231.0, + 32.0 ] }, "_rankingScoreDetails": { @@ -1096,9 +1096,9 @@ async fn experimental_feature_vector_store() { "id": "287947", "_vectors": { "manual": [ - 1, - 2, - 3 + 1.0, + 2.0, + 3.0 ] }, "_rankingScore": 1.0 @@ -1108,9 +1108,9 @@ async fn experimental_feature_vector_store() { "id": "299537", "_vectors": { "manual": [ - 1, - 2, - 54 + 1.0, + 2.0, + 54.0 ] }, "_rankingScore": 0.9129111766815186 @@ -1120,9 +1120,9 @@ async fn experimental_feature_vector_store() { "id": "450465", "_vectors": { "manual": [ - -100, - 340, - 90 + -100.0, + 340.0, + 90.0 ] }, "_rankingScore": 0.8106412887573242 @@ -1132,9 +1132,9 @@ async fn experimental_feature_vector_store() { "id": "166428", "_vectors": { "manual": [ - -100, - 231, - 32 + -100.0, + 231.0, + 32.0 ] }, "_rankingScore": 0.7412010431289673 @@ -1144,9 +1144,9 @@ async fn experimental_feature_vector_store() { "id": "522681", "_vectors": { "manual": [ - 10, - -23, - 32 + 10.0, + -23.0, + 32.0 ] }, "_rankingScore": 0.6972063183784485 @@ -1405,9 +1405,9 @@ async fn simple_search_with_strange_synonyms() { "id": "166428", "_vectors": { "manual": [ - -100, - 231, - 32 + -100.0, + 231.0, + 32.0 ] } } @@ -1426,9 +1426,9 @@ async fn simple_search_with_strange_synonyms() { "id": "166428", "_vectors": { "manual": [ - -100, - 231, - 32 + -100.0, + 231.0, + 32.0 ] } } @@ -1447,9 +1447,9 @@ async fn simple_search_with_strange_synonyms() { "id": "166428", "_vectors": { "manual": [ - -100, - 231, - 32 + -100.0, + 231.0, + 32.0 ] } } diff --git a/meilisearch/tests/search/multi.rs b/meilisearch/tests/search/multi.rs index aeec1bad4..b5cf8f476 100644 --- a/meilisearch/tests/search/multi.rs +++ b/meilisearch/tests/search/multi.rs @@ -75,9 +75,9 @@ async fn simple_search_single_index() { "id": "450465", "_vectors": { "manual": [ - -100, - 340, - 90 + -100.0, + 340.0, + 90.0 ] } } @@ -96,9 +96,9 @@ async fn simple_search_single_index() { "id": "299537", "_vectors": { "manual": [ - 1, - 2, - 54 + 1.0, + 2.0, + 54.0 ] } } @@ -194,9 +194,9 @@ async fn simple_search_two_indexes() { "id": "450465", "_vectors": { "manual": [ - -100, - 340, - 90 + -100.0, + 340.0, + 90.0 ] } } @@ -227,9 +227,9 @@ async fn simple_search_two_indexes() { "cattos": "pésti", "_vectors": { "manual": [ - 1, - 2, - 3 + 1.0, + 2.0, + 3.0 ] } }, @@ -249,9 +249,9 @@ async fn simple_search_two_indexes() { ], "_vectors": { "manual": [ - 1, - 2, - 54 + 1.0, + 2.0, + 54.0 ] } } diff --git a/milli/src/update/index_documents/typed_chunk.rs b/milli/src/update/index_documents/typed_chunk.rs index 6f11dd585..6615a4bc3 100644 --- a/milli/src/update/index_documents/typed_chunk.rs +++ b/milli/src/update/index_documents/typed_chunk.rs @@ -234,11 +234,13 @@ pub(crate) fn write_typed_chunk_into_index( addition, ) else { + // if the `_vectors` field cannot be parsed as map of vectors, just write it as-is break 'vectors Some(addition); }; vectors.retain_user_provided_vectors(); let crate::vector::parsed_vectors::ParsedVectors(vectors) = vectors; if vectors.is_empty() { + // skip writing empty `_vectors` map break 'vectors None; }