mirror of
https://github.com/deepset-ai/haystack.git
synced 2025-11-01 10:19:23 +00:00
refactor: Mark MilvusDocumentStore as deprecated (#4498)
* Mark MilvusDocumentStore as deprecated * Fix mypy
This commit is contained in:
parent
5b63c2086e
commit
3b5223fa1c
@ -16,7 +16,7 @@ except (ImportError, ModuleNotFoundError) as ie:
|
||||
_optional_component_not_installed(__name__, "milvus2", ie)
|
||||
|
||||
from haystack.schema import Document, FilterType
|
||||
from haystack.document_stores.sql import SQLDocumentStore
|
||||
from haystack.document_stores import SQLDocumentStore
|
||||
from haystack.document_stores.base import get_batches_from_generator
|
||||
from haystack.nodes.retriever import DenseRetriever
|
||||
|
||||
@ -128,6 +128,11 @@ class MilvusDocumentStore(SQLDocumentStore):
|
||||
lost if you choose to recreate the index. Be aware that both the document_index and the label_index will
|
||||
be recreated.
|
||||
"""
|
||||
warnings.warn(
|
||||
"The MilvusDocumentStore node is deprecated and will be removed in future versions.",
|
||||
category=DeprecationWarning,
|
||||
)
|
||||
|
||||
super().__init__(
|
||||
url=sql_url, index=index, duplicate_documents=duplicate_documents, isolation_level=isolation_level
|
||||
)
|
||||
|
||||
@ -1,10 +1,13 @@
|
||||
import pytest
|
||||
import numpy as np
|
||||
from unittest.mock import patch, DEFAULT
|
||||
|
||||
from haystack.document_stores.milvus import MilvusDocumentStore
|
||||
from haystack.schema import Document
|
||||
from haystack.testing import DocumentStoreBaseTestAbstract
|
||||
|
||||
from ..conftest import fail_at_version
|
||||
|
||||
|
||||
class TestMilvusDocumentStore(DocumentStoreBaseTestAbstract):
|
||||
@pytest.fixture
|
||||
@ -47,6 +50,23 @@ class TestMilvusDocumentStore(DocumentStoreBaseTestAbstract):
|
||||
|
||||
return documents
|
||||
|
||||
@pytest.mark.unit
|
||||
@fail_at_version(1, 17)
|
||||
def test_deprecation_warning(self):
|
||||
with patch.multiple(
|
||||
"haystack.document_stores.milvus",
|
||||
SQLDocumentStore=DEFAULT,
|
||||
FieldSchema=DEFAULT,
|
||||
CollectionSchema=DEFAULT,
|
||||
Collection=DEFAULT,
|
||||
connections=DEFAULT,
|
||||
utility=DEFAULT,
|
||||
QueryResult=DEFAULT,
|
||||
DataType=DEFAULT,
|
||||
):
|
||||
with pytest.warns(DeprecationWarning):
|
||||
MilvusDocumentStore()
|
||||
|
||||
@pytest.mark.integration
|
||||
def test_delete_index(self, ds, documents):
|
||||
"""Contrary to other Document Stores, MilvusDocumentStore doesn't raise if the index is empty"""
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user