Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AlisoSouza committed Jun 27, 2024
1 parent 2e07b65 commit 6577829
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/store/elasticsearch_vector_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def search_delete(self, search_filter: dict, scroll_id: str = None) -> tuple[str

def search(self, search: str, filter=None, threshold=0.1) -> list[Document]:
content_base_uuid = filter.get("content_base_uuid")
q = {'bool': {'filter': [{'term': {'metadata.content_base_uuid.keyword': content_base_uuid}}]}}
q = {"bool": {"filter": [{"term": {"metadata.content_base_uuid.keyword": content_base_uuid}}]}}


docs = self.vectorstore.similarity_search_with_score(query=search, k=5, filter=q)
Expand Down
2 changes: 1 addition & 1 deletion app/tests/test_elasticsearch_vector_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def test_search(self):
search="test", filter=query_filter
)
self.vectorstore.similarity_search_with_score.assert_called_once_with(
query="test", k=5, filter={'match': {'metadata.content_base_uuid': 'dfff32e7-dce6-40f7-a86e-8f9618887977'}}
query="test", k=5, filter={"bool": {"filter": [{"term": {"metadata.content_base_uuid.keyword": "dfff32e7-dce6-40f7-a86e-8f9618887977"}}]}}
)
self.assertEqual(1, len(results))
self.assertEqual(results[0].page_content, "test doc")
Expand Down

0 comments on commit 6577829

Please sign in to comment.