Skip to content

Commit 75860f8

Browse files
Merge #963
963: Fix document and vector fixture r=curquiza a=sanders41 # Pull Request In looking at #962 I noticed that the `index_with_documents_and_vectors` fixture was not working as expected and therefore the `test_vector_search` test was not testing what was expected. Because only one document had vectors the document addition task was failing and no documents were added to the index. So `test_vector_search` was returning no hits because there were no documents in the index. This updates the fixutre to add vectors to all documents, and updates the test to pass with the new results. ## Related issue Fixes #<issue_number> ## What does this PR do? - Fixes the `test_vector_search` test. ## PR checklist Please check if your PR fulfills the following requirements: - [ ] Does this PR fix an existing issue, or have you listed the changes applied in the PR description (and why they are needed)? - [ ] Have you read the contributing guidelines? - [ ] Have you made sure that the title is accurate and descriptive of the changes? Thank you so much for contributing to Meilisearch! Co-authored-by: Paul Sanders <[email protected]>
2 parents e4c0303 + a2256b2 commit 75860f8

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

tests/conftest.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@ def index_maker(index_uid=common.INDEX_UID, documents=small_movies):
131131
@fixture(scope="function")
132132
def index_with_documents_and_vectors(empty_index, small_movies):
133133
small_movies[0]["_vectors"] = {"default": [0.1, 0.2]}
134+
for movie in small_movies[1:]:
135+
movie["_vectors"] = {"default": [0.9, 0.9]}
134136

135137
def index_maker(index_uid=common.INDEX_UID, documents=small_movies):
136138
index = empty_index(index_uid)

tests/index/test_index_search_meilisearch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,4 +464,4 @@ def test_vector_search(index_with_documents_and_vectors):
464464
response = index_with_documents_and_vectors().search(
465465
"", opt_params={"vector": [0.1, 0.2], "hybrid": {"semanticRatio": 1.0}}
466466
)
467-
assert response["hits"] == []
467+
assert len(response["hits"]) > 0

0 commit comments

Comments
 (0)