diff --git a/docarray/index/backends/qdrant.py b/docarray/index/backends/qdrant.py index aa0d49095e..6f1330f9ea 100644 --- a/docarray/index/backends/qdrant.py +++ b/docarray/index/backends/qdrant.py @@ -269,7 +269,7 @@ def python_type_to_db_type(self, python_type: Type) -> Any: :param python_type: a python type. :return: the corresponding database column type. """ - if any(issubclass(python_type, vt) for vt in QDRANT_PY_VECTOR_TYPES): + if any(safe_issubclass(python_type, vt) for vt in QDRANT_PY_VECTOR_TYPES): return 'vector' if safe_issubclass(python_type, docarray.typing.id.ID): diff --git a/tests/index/qdrant/test_configurations.py b/tests/index/qdrant/test_configurations.py index d17ebbbdeb..93aed2dfe0 100644 --- a/tests/index/qdrant/test_configurations.py +++ b/tests/index/qdrant/test_configurations.py @@ -1,3 +1,5 @@ +from typing import List + import numpy as np import pytest from pydantic import Field @@ -7,7 +9,6 @@ from docarray.typing import NdArray from tests.index.qdrant.fixtures import start_storage, tmp_collection_name # noqa: F401 - pytestmark = [pytest.mark.slow, pytest.mark.index] @@ -44,3 +45,12 @@ class Schema(BaseDoc): index3 = QdrantDocumentIndex[Schema](collection_name='my_index') assert index3.index_name == 'my_index' + + +def test_index_with_non_class_type(): + class Schema(BaseDoc): + tens: NdArray = Field(dim=10) + list_field: List + + index = QdrantDocumentIndex[Schema]() + assert index.num_docs() == 0