Skip to content

Commit

Permalink
Fix search result (#1748)
Browse files Browse the repository at this point in the history
1. Print id instead of pk
2. Return the correct data type for future.result()

Signed-off-by: yangxuan <[email protected]>
  • Loading branch information
XuanYang-cn authored Oct 23, 2023
1 parent 74ef426 commit 0c513eb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pymilvus/client/abstract.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__

Expand Down
5 changes: 3 additions & 2 deletions pymilvus/orm/future.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

from typing import Any

from pymilvus.client.abstract import SearchResult
from pymilvus.grpc_gen import schema_pb2

from .mutation import MutationResult
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 0c513eb

Please sign in to comment.