From 55b4acc27b564aad169622d9a5747b9e5b274ffc Mon Sep 17 00:00:00 2001 From: yhz <413554850@qq.com> Date: Tue, 26 Nov 2019 14:37:05 +0800 Subject: [PATCH] [skip ci]afix shards bug when serch result is empty --- shards/mishards/service_handler.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/shards/mishards/service_handler.py b/shards/mishards/service_handler.py index f192aff72c..297e349f45 100644 --- a/shards/mishards/service_handler.py +++ b/shards/mishards/service_handler.py @@ -61,6 +61,10 @@ class ServiceHandler(milvus_pb2_grpc.MilvusServiceServicer): return status, [], [] row_num = files_collection.row_num + # row_num is equal to 0, result is empty + if not row_num: + continue + ids = files_collection.ids diss = files_collection.distances # distance collections # TODO: batch_len is equal to topk, may need to compare with topk @@ -322,7 +326,7 @@ class ServiceHandler(milvus_pb2_grpc.MilvusServiceServicer): topk_result_list = milvus_pb2.TopKQueryResult( status=status_pb2.Status(error_code=status.error_code, reason=status.reason), - row_num=len(query_record_array), + row_num=len(id_results), ids=id_results, distances=dis_results) return topk_result_list