Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
2 changes: 1 addition & 1 deletion integrations/pgvector/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ classifiers = [
"Programming Language :: Python :: Implementation :: PyPy",
]
dependencies = [
"haystack-ai>=2.24.0",
"haystack-ai>=2.26.1",
"pgvector>=0.3.0",
"psycopg[binary]"
]
Expand Down
24 changes: 24 additions & 0 deletions integrations/pgvector/tests/test_document_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,16 @@
from haystack.document_stores.errors import DocumentStoreError, DuplicateDocumentError
from haystack.document_stores.types import DuplicatePolicy
from haystack.testing.document_store import (
CountDocumentsByFilterTest,
CountDocumentsTest,
CountUniqueMetadataByFilterTest,
DeleteAllTest,
DeleteByFilterTest,
DeleteDocumentsTest,
FilterableDocsFixtureMixin,
GetMetadataFieldMinMaxTest,
GetMetadataFieldsInfoTest,
GetMetadataFieldUniqueValuesTest,
UpdateByFilterTest,
WriteDocumentsTest,
)
Expand All @@ -32,7 +37,26 @@ class TestDocumentStore(
FilterableDocsFixtureMixin,
UpdateByFilterTest,
WriteDocumentsTest,
CountDocumentsByFilterTest,
CountUniqueMetadataByFilterTest,
GetMetadataFieldsInfoTest,
GetMetadataFieldMinMaxTest,
GetMetadataFieldUniqueValuesTest,
):
def test_get_metadata_fields_info_empty_collection(self, document_store: PgvectorDocumentStore):
"""PgvectorDocumentStore always includes 'content' in fields info, even for empty stores."""
assert document_store.count_documents() == 0

fields_info = document_store.get_metadata_fields_info()
assert fields_info == {"content": {"type": "text"}}

def test_get_metadata_field_min_max_empty_collection(self, document_store: PgvectorDocumentStore):
"""PgvectorDocumentStore raises ValueError when the field doesn't exist in the store."""
assert document_store.count_documents() == 0

with pytest.raises(ValueError, match="not found in document store"):
document_store.get_metadata_field_min_max("priority")

def test_write_documents(self, document_store: PgvectorDocumentStore):
docs = [Document(id="1")]
assert document_store.write_documents(docs) == 1
Expand Down
Loading