Skip to content

Commit e4fc490

Browse files
author
Andrew Zhai
committed
hack milvus to not load or release
1 parent a4f0659 commit e4fc490

File tree

1 file changed

+0
-11
lines changed

1 file changed

+0
-11
lines changed

docarray/index/backends/milvus.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ def __init__(self, db_config=None, **kwargs):
9494
self._field_name = self._get_vector_field_name()
9595
self._collection = self._create_or_load_collection()
9696
self._build_index()
97-
self._collection.load()
9897
self._logger.info(f'{self.__class__.__name__} has been initialized')
9998

10099
@dataclass
@@ -426,7 +425,6 @@ def num_docs(self) -> int:
426425
especially after delete ops (#15201 issue in Milvus)
427426
"""
428427

429-
self._collection.load()
430428

431429
result = self._collection.query(
432430
expr=self._always_true_expr("id"),
@@ -448,7 +446,6 @@ def _get_items(
448446
Duplicate `doc_ids` can be omitted in the output.
449447
"""
450448

451-
self._collection.load()
452449
results: List[Dict] = []
453450
for batch in self._get_batches(
454451
doc_ids, batch_size=self._runtime_config.batch_size
@@ -462,7 +459,6 @@ def _get_items(
462459
)
463460
)
464461

465-
self._collection.release()
466462

467463
return self._docs_from_query_response(results)
468464

@@ -471,7 +467,6 @@ def _del_items(self, doc_ids: Sequence[str]):
471467
472468
:param doc_ids: ids to delete from the Document Store
473469
"""
474-
self._collection.load()
475470
for batch in self._get_batches(
476471
doc_ids, batch_size=self._runtime_config.batch_size
477472
):
@@ -494,7 +489,6 @@ def _filter(
494489
:return: Filter results.
495490
"""
496491

497-
self._collection.load()
498492

499493
result = self._collection.query(
500494
expr=filter_query,
@@ -503,7 +497,6 @@ def _filter(
503497
output_fields=["serialized"],
504498
)
505499

506-
self._collection.release()
507500

508501
return self._docs_from_query_response(result)
509502

@@ -616,7 +609,6 @@ def _hybrid_search(
616609
:param expr: Boolean expression used for filtering.
617610
:return: Search results.
618611
"""
619-
self._collection.load()
620612

621613
results = self._collection.search(
622614
data=[query],
@@ -629,7 +621,6 @@ def _hybrid_search(
629621
consistency_level=self._db_config.consistency_level,
630622
)
631623

632-
self._collection.release()
633624

634625
results = next(iter(results), None) # Only consider the first element
635626

@@ -707,7 +698,6 @@ def _find_batched(
707698
:return: Search results.
708699
"""
709700

710-
self._collection.load()
711701

712702
results = self._collection.search(
713703
data=queries,
@@ -719,7 +709,6 @@ def _find_batched(
719709
consistency_level=self._db_config.consistency_level,
720710
)
721711

722-
self._collection.release()
723712

724713
documents, scores = zip(
725714
*[self._docs_from_find_response(result) for result in results]

0 commit comments

Comments
 (0)