From 3674e6418fe1b9de8cc832737a4f148cc6f21a56 Mon Sep 17 00:00:00 2001 From: Paul Sanders Date: Tue, 21 May 2024 17:14:01 -0400 Subject: [PATCH 1/2] Fix document and vector fixture --- tests/conftest.py | 2 ++ tests/index/test_index_search_meilisearch.py | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index a88999a8..a00d85e9 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -131,6 +131,8 @@ def index_maker(index_uid=common.INDEX_UID, documents=small_movies): @fixture(scope="function") def index_with_documents_and_vectors(empty_index, small_movies): small_movies[0]["_vectors"] = {"default": [0.1, 0.2]} + for movie in small_movies[1:]: + movie["_vectors"] = {"default": [0.9, 0.9]} def index_maker(index_uid=common.INDEX_UID, documents=small_movies): index = empty_index(index_uid) diff --git a/tests/index/test_index_search_meilisearch.py b/tests/index/test_index_search_meilisearch.py index e2681e09..d7be40a9 100644 --- a/tests/index/test_index_search_meilisearch.py +++ b/tests/index/test_index_search_meilisearch.py @@ -462,6 +462,6 @@ def test_attributes_to_search_on_search_no_match(index_with_documents): @pytest.mark.usefixtures("enable_vector_search") def test_vector_search(index_with_documents_and_vectors): response = index_with_documents_and_vectors().search( - "", opt_params={"vector": [0.1, 0.2], "hybrid": {"semanticRatio": 1.0}} + "Shazam", opt_params={"vector": [0.1, 0.2], "hybrid": {"semanticRatio": 1.0}} ) - assert response["hits"] == [] + assert len(response["hits"]) > 0 From a2256b24a9dc06f2e0b9eacd253b96192d21e2c6 Mon Sep 17 00:00:00 2001 From: Paul Sanders Date: Tue, 21 May 2024 18:16:46 -0400 Subject: [PATCH 2/2] Use placeholder search --- tests/index/test_index_search_meilisearch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/index/test_index_search_meilisearch.py b/tests/index/test_index_search_meilisearch.py index d7be40a9..896d4cff 100644 --- a/tests/index/test_index_search_meilisearch.py +++ b/tests/index/test_index_search_meilisearch.py @@ -462,6 +462,6 @@ def test_attributes_to_search_on_search_no_match(index_with_documents): @pytest.mark.usefixtures("enable_vector_search") def test_vector_search(index_with_documents_and_vectors): response = index_with_documents_and_vectors().search( - "Shazam", opt_params={"vector": [0.1, 0.2], "hybrid": {"semanticRatio": 1.0}} + "", opt_params={"vector": [0.1, 0.2], "hybrid": {"semanticRatio": 1.0}} ) assert len(response["hits"]) > 0