Skip to content

Commit 4e30085

Browse files
feat: [2.6] Update proto to support highlight score (#3195)
milvus-io/milvus#46994 pr: #3194 Signed-off-by: junjie.jiang <junjie.jiang@zilliz.com>
1 parent ad94cc7 commit 4e30085

File tree

4 files changed

+50
-47
lines changed

4 files changed

+50
-47
lines changed

pymilvus/client/search_result.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import logging
2+
from collections import UserDict
23
from typing import Any, Dict, List, Optional, Tuple, Union
34

45
import numpy as np
@@ -98,7 +99,10 @@ def __init__(
9899
if len(highlight_results) > 0:
99100
for i, hit in enumerate(top_k_res):
100101
hit["highlight"] = {
101-
result.field_name: list(result.datas[i + start].fragments)
102+
result.field_name: {
103+
"fragments": list(result.datas[i + start].fragments),
104+
"scores": list(result.datas[i + start].scores),
105+
}
102106
for result in highlight_results
103107
}
104108

@@ -711,9 +715,6 @@ def __str__(self) -> str:
711715
__repr__ = __str__
712716

713717

714-
from collections import UserDict
715-
716-
717718
class Hit(UserDict):
718719
"""Enhanced result in dict that can get data in dict[dict]
719720

pymilvus/grpc_gen/common_pb2.py

Lines changed: 40 additions & 40 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pymilvus/grpc_gen/common_pb2.pyi

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -994,10 +994,12 @@ class ReplicateCheckpoint(_message.Message):
994994
def __init__(self, cluster_id: _Optional[str] = ..., pchannel: _Optional[str] = ..., message_id: _Optional[_Union[MessageID, _Mapping]] = ..., time_tick: _Optional[int] = ...) -> None: ...
995995

996996
class HighlightData(_message.Message):
997-
__slots__ = ("fragments",)
997+
__slots__ = ("fragments", "scores")
998998
FRAGMENTS_FIELD_NUMBER: _ClassVar[int]
999+
SCORES_FIELD_NUMBER: _ClassVar[int]
9991000
fragments: _containers.RepeatedScalarFieldContainer[str]
1000-
def __init__(self, fragments: _Optional[_Iterable[str]] = ...) -> None: ...
1001+
scores: _containers.RepeatedScalarFieldContainer[float]
1002+
def __init__(self, fragments: _Optional[_Iterable[str]] = ..., scores: _Optional[_Iterable[float]] = ...) -> None: ...
10011003

10021004
class HighlightResult(_message.Message):
10031005
__slots__ = ("field_name", "datas")

0 commit comments

Comments
 (0)