From 94b9f3b310fec35ac3d215d2725e460bd5ff64af Mon Sep 17 00:00:00 2001 From: Louis Dureuil Date: Wed, 3 Jan 2024 12:45:13 +0100 Subject: [PATCH 1/2] Add test --- meilisearch/tests/search/hybrid.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/meilisearch/tests/search/hybrid.rs b/meilisearch/tests/search/hybrid.rs index 77a29d4a3..79819cab2 100644 --- a/meilisearch/tests/search/hybrid.rs +++ b/meilisearch/tests/search/hybrid.rs @@ -56,6 +56,15 @@ static SIMPLE_SEARCH_DOCUMENTS: Lazy = Lazy::new(|| { }]) }); +static SINGLE_DOCUMENT: Lazy = Lazy::new(|| { + json!([{ + "title": "Shazam!", + "desc": "a Captain Marvel ersatz", + "id": "1", + "_vectors": {"default": [1.0, 3.0]}, + }]) +}); + #[actix_rt::test] async fn simple_search() { let server = Server::new().await; @@ -149,3 +158,18 @@ async fn invalid_semantic_ratio() { } "###); } + +#[actix_rt::test] +async fn single_document() { + let server = Server::new().await; + let index = index_with_documents(&server, &SINGLE_DOCUMENT).await; + + let (response, code) = index + .search_post( + json!({"vector": [1.0, 3.0], "hybrid": {"semanticRatio": 1.0}, "showRankingScore": true}), + ) + .await; + + snapshot!(code, @"200 OK"); + snapshot!(response["hits"][0], @r###"{"title":"Shazam!","desc":"a Captain Marvel ersatz","id":"1","_vectors":{"default":[1.0,3.0]},"_rankingScore":1.0,"_semanticScore":1.0}"###); +} From 12edc2c20a3ae0a0ead0ac301b3c51c47a803e0d Mon Sep 17 00:00:00 2001 From: Louis Dureuil Date: Wed, 3 Jan 2024 15:59:37 +0100 Subject: [PATCH 2/2] Update arroy to a fixed version --- Cargo.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 496710399..72701288f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -383,7 +383,7 @@ dependencies = [ [[package]] name = "arroy" version = "0.1.0" -source = "git+https://github.com/meilisearch/arroy.git#4f193fd534acd357b65bfe9eec4b3fed8ece2007" +source = "git+https://github.com/meilisearch/arroy.git#d372648212e561a4845077cdb9239423d78655a2" dependencies = [ "bytemuck", "byteorder",