From f96b9082abee510518a06183820cfeff025d2328 Mon Sep 17 00:00:00 2001 From: zhuwenxing Date: Mon, 16 Oct 2023 14:22:20 +0800 Subject: [PATCH] fix index error code Signed-off-by: zhuwenxing --- pymilvus/client/grpc_handler.py | 4 ++-- pymilvus/client/types.py | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pymilvus/client/grpc_handler.py b/pymilvus/client/grpc_handler.py index 699e510b4..b34fd1f5a 100644 --- a/pymilvus/client/grpc_handler.py +++ b/pymilvus/client/grpc_handler.py @@ -911,7 +911,7 @@ def list_indexes(self, collection_name: str, timeout: Optional[float] = None, ** status = response.status if status.code == 0: return response.index_descriptions - if status.code == Status.INDEX_NOT_EXIST: + if status.code in [Status.INDEX_NOT_EXIST, Status.INDEX_NOT_FOUND]: return [] raise MilvusException(status.code, status.reason, status.error_code) @@ -930,7 +930,7 @@ def describe_index( rf = self._stub.DescribeIndex.future(request, timeout=timeout) response = rf.result() status = response.status - if status.code == Status.INDEX_NOT_EXIST: + if status.code in [Status.INDEX_NOT_EXIST, Status.INDEX_NOT_FOUND]: return None if status.code != 0: raise MilvusException(status.code, status.reason) diff --git a/pymilvus/client/types.py b/pymilvus/client/types.py index 0c64ba724..71c6cdbd9 100644 --- a/pymilvus/client/types.py +++ b/pymilvus/client/types.py @@ -49,6 +49,7 @@ class Status: OUT_OF_MEMORY = 24 INDEX_NOT_EXIST = 25 EMPTY_COLLECTION = 26 + INDEX_NOT_FOUND = 700 def __init__(self, code: int = SUCCESS, message: str = "Success") -> None: self.code = code