Skip to content

Commit 3fe6f9e

Browse files
authored
Fix hybrid_search to support EmbeddingList in request data (#3028)
- Add EmbeddingList import to grpc_handler.py - Add automatic conversion of EmbeddingList to flat array in hybrid_search - Set is_embedding_list flag when EmbeddingList is detected - This enables hybrid search to work with struct array vector fields This fix aligns hybrid_search behavior with the regular search method, which already supports EmbeddingList conversion. Signed-off-by: zhuwenxing <[email protected]>
1 parent d7f0954 commit 3fe6f9e

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

pymilvus/client/grpc_handler.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
is_legal_port,
4545
)
4646
from .constants import ITERATOR_SESSION_TS_FIELD
47+
from .embedding_list import EmbeddingList
4748
from .interceptor import _api_level_md
4849
from .prepare import Prepare
4950
from .search_result import SearchResult
@@ -997,17 +998,24 @@ def hybrid_search(
997998

998999
requests = []
9991000
for req in reqs:
1001+
# Convert EmbeddingList to flat array if present in the request data
1002+
data = req.data
1003+
req_kwargs = dict(kwargs)
1004+
if isinstance(data, list) and data and isinstance(data[0], EmbeddingList):
1005+
data = [emb_list.to_flat_array() for emb_list in data]
1006+
req_kwargs["is_embedding_list"] = True
1007+
10001008
search_request = Prepare.search_requests_with_expr(
10011009
collection_name,
1002-
req.data,
1010+
data,
10031011
req.anns_field,
10041012
req.param,
10051013
req.limit,
10061014
req.expr,
10071015
partition_names=partition_names,
10081016
round_decimal=round_decimal,
10091017
expr_params=req.expr_params,
1010-
**kwargs,
1018+
**req_kwargs,
10111019
)
10121020
requests.append(search_request)
10131021

0 commit comments

Comments
 (0)