From 55e69ea4c42fd080555f87334e96d01c127d2c9e Mon Sep 17 00:00:00 2001 From: yangxuan Date: Mon, 23 Oct 2023 15:22:32 +0800 Subject: [PATCH] Fix search result 1. Print id instead of pk 2. Return the correct data type for future.result() Signed-off-by: yangxuan --- pymilvus/client/abstract.py | 2 +- pymilvus/orm/future.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/pymilvus/client/abstract.py b/pymilvus/client/abstract.py index 7672b278f..d92801178 100644 --- a/pymilvus/client/abstract.py +++ b/pymilvus/client/abstract.py @@ -469,7 +469,7 @@ def get(self, field_name: str) -> Any: return self.fields.get(field_name) def __str__(self) -> str: - return f"pk: {self.id}, distance: {self.distance}, entity: {self.fields}" + return f"id: {self.id}, distance: {self.distance}, entity: {self.fields}" __repr__ = __str__ diff --git a/pymilvus/orm/future.py b/pymilvus/orm/future.py index 6ec635ff3..8b34e9983 100644 --- a/pymilvus/orm/future.py +++ b/pymilvus/orm/future.py @@ -13,6 +13,7 @@ from typing import Any from pymilvus.grpc_gen import schema_pb2 +from pymilvus.client.abstract import SearchResult from .mutation import MutationResult @@ -43,8 +44,8 @@ def done(self): class _EmptySearchFuture: - def result(self) -> schema_pb2.SearchResultData: - return schema_pb2.SearchResultData() + def result(self) -> SearchResult: + return SearchResult(schema_pb2.SearchResultData()) def cancel(self) -> None: pass