community: add a flag that determines whether to load the milvus collection (#15693)

fix https://github.com/langchain-ai/langchain/issues/15694

---------

Co-authored-by: hyungwookyang <hyungwookyang@worksmobile.com>
Co-authored-by: Bagatur <baskaryan@gmail.com>
pull/16049/head
YHW 9 months ago committed by GitHub
parent 9e779ca846
commit ce21392a21
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -446,9 +446,15 @@ class Milvus(VectorStore):
timeout: Optional[float] = None,
) -> None:
"""Load the collection if available."""
from pymilvus import Collection
from pymilvus import Collection, utility
from pymilvus.client.types import LoadState
if isinstance(self.col, Collection) and self._get_index() is not None:
if (
isinstance(self.col, Collection)
and self._get_index() is not None
and utility.load_state(self.collection_name, using=self.alias)
== LoadState.NotLoad
):
self.col.load(
partition_names=partition_names,
replica_number=replica_number,

Loading…
Cancel
Save