Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 0 additions & 44 deletions integrations/qdrant/tests/test_document_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -629,47 +629,3 @@ def test_get_metadata_field_unique_values_pagination(self, document_store: Qdran

# Values should not overlap
assert set(values_page_1) != set(values_page_2)

def test_get_metadata_field_unique_values_with_filter(self, document_store: QdrantDocumentStore):
"""Test getting unique metadata field values with filtering."""
docs = [
Document(content="Doc 1", meta={"category": "A", "status": "active"}),
Document(content="Doc 2", meta={"category": "B", "status": "active"}),
Document(content="Doc 3", meta={"category": "A", "status": "inactive"}),
]
document_store.write_documents(docs)

values, total = document_store.get_metadata_field_unique_values(
"category", filters={"field": "meta.status", "operator": "==", "value": "active"}
)
assert set(values) == {"A", "B"}
assert total == 2

def test_get_metadata_field_unique_values_with_meta_prefix(self, document_store: QdrantDocumentStore):
"""Test that a 'meta.'-prefixed field name is normalized before lookup."""
docs = [
Document(content="Doc 1", meta={"category": "A"}),
Document(content="Doc 2", meta={"category": "B"}),
]
document_store.write_documents(docs)

values, total = document_store.get_metadata_field_unique_values("meta.category")
assert set(values) == {"A", "B"}
assert total == 2

def test_get_metadata_field_unique_values_with_search_term(self, document_store: QdrantDocumentStore):
"""Test that search_term filters unique values by a case-insensitive substring match on the field value."""
docs = [
Document(content="Doc 1", meta={"category": "Apple"}),
Document(content="Doc 2", meta={"category": "Banana"}),
Document(content="Doc 3", meta={"category": "Apricot"}),
]
document_store.write_documents(docs)

values, total = document_store.get_metadata_field_unique_values("category", search_term="ap")
assert set(values) == {"Apple", "Apricot"}
assert total == 2

values, total = document_store.get_metadata_field_unique_values("category", search_term="nonexistent")
assert values == []
assert total == 0
31 changes: 0 additions & 31 deletions integrations/qdrant/tests/test_document_store_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,34 +342,3 @@ async def test_update_by_filter_async_preserves_vectors(self, document_store: Qd
assert len(updated_docs) == 1
assert updated_docs[0].embedding is not None
assert len(updated_docs[0].embedding) == 768

async def test_get_metadata_field_unique_values_with_meta_prefix_async(self, document_store: QdrantDocumentStore):
"""Test that a 'meta.'-prefixed field name is normalized before lookup."""
docs = [
Document(content="Doc 1", meta={"category": "A"}),
Document(content="Doc 2", meta={"category": "B"}),
]
await document_store.write_documents_async(docs)

values, total = await document_store.get_metadata_field_unique_values_async("meta.category")
assert set(values) == {"A", "B"}
assert total == 2

async def test_get_metadata_field_unique_values_with_search_term_async(self, document_store: QdrantDocumentStore):
"""Test that search_term filters unique values by a case-insensitive substring match on the field value."""
docs = [
Document(content="Doc 1", meta={"category": "Apple"}),
Document(content="Doc 2", meta={"category": "Banana"}),
Document(content="Doc 3", meta={"category": "Apricot"}),
]
await document_store.write_documents_async(docs)

values, total = await document_store.get_metadata_field_unique_values_async("category", search_term="ap")
assert set(values) == {"Apple", "Apricot"}
assert total == 2

values, total = await document_store.get_metadata_field_unique_values_async(
"category", search_term="nonexistent"
)
assert values == []
assert total == 0
Loading