Fixing storage and adding tests

This commit is contained in:
Cyber MacGeddon 2025-07-14 22:15:19 +01:00
parent fcd8246d8e
commit 4582abd5fc
2 changed files with 6 additions and 8 deletions

View file

@ -443,16 +443,10 @@ class TestMilvusGraphEmbeddingsQueryProcessor:
limit=0
)
# Mock search results
mock_results = [
{"entity": {"entity": "http://example.com/entity1"}},
]
processor.vecstore.search.return_value = mock_results
result = await processor.query_graph_embeddings(query)
# Verify search was called with 0 limit
processor.vecstore.search.assert_called_once_with([0.1, 0.2, 0.3], limit=0)
# Verify no search was called (optimization for zero limit)
processor.vecstore.search.assert_not_called()
# Verify empty results due to zero limit
assert len(result) == 0

View file

@ -39,6 +39,10 @@ class Processor(GraphEmbeddingsQueryService):
entity_set = set()
entities = []
# Handle zero limit case
if msg.limit <= 0:
return []
for vec in msg.vectors:
resp = self.vecstore.search(vec, limit=msg.limit * 2)