mirror of
https://github.com/deepset-ai/haystack.git
synced 2025-09-25 08:04:49 +00:00
Fix behavior of delete_documents() with filters for Milvus (#1354)
* Fix behavior of delete_documents() Delete filtered set of vectors rather than the whole collection * Update milvus.py * Update milvus.py
This commit is contained in:
parent
51f0a56e5d
commit
4ca97dd5be
@ -403,9 +403,13 @@ class MilvusDocumentStore(SQLDocumentStore):
|
|||||||
if status.code != Status.SUCCESS:
|
if status.code != Status.SUCCESS:
|
||||||
raise RuntimeError(f'Milvus has collection check failed: {status}')
|
raise RuntimeError(f'Milvus has collection check failed: {status}')
|
||||||
if ok:
|
if ok:
|
||||||
status = self.milvus_server.drop_collection(collection_name=index)
|
if filters:
|
||||||
if status.code != Status.SUCCESS:
|
existing_docs = super().get_all_documents(filters=filters, index=index)
|
||||||
raise RuntimeError(f'Milvus drop collection failed: {status}')
|
self._delete_vector_ids_from_milvus(documents=existing_docs, index=index)
|
||||||
|
else:
|
||||||
|
status = self.milvus_server.drop_collection(collection_name=index)
|
||||||
|
if status.code != Status.SUCCESS:
|
||||||
|
raise RuntimeError(f'Milvus drop collection failed: {status}')
|
||||||
|
|
||||||
self.milvus_server.flush([index])
|
self.milvus_server.flush([index])
|
||||||
self.milvus_server.compact(collection_name=index)
|
self.milvus_server.compact(collection_name=index)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user