Skip to content

Commit

Permalink
enhance: simplify the structure of search_params (#2507)
Browse files Browse the repository at this point in the history
Signed-off-by: lixinguo <[email protected]>
Co-authored-by: lixinguo <[email protected]>
  • Loading branch information
smellthemoon and lixinguo authored Dec 31, 2024
1 parent fde81bf commit e398893
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion pymilvus/client/prepare.py
Original file line number Diff line number Diff line change
Expand Up @@ -943,7 +943,6 @@ def search_requests_with_expr(

search_params = {
"topk": limit,
"params": params,
"round_decimal": round_decimal,
"ignore_growing": ignore_growing,
}
Expand Down Expand Up @@ -999,6 +998,20 @@ def search_requests_with_expr(
if param.get(HINTS) is not None:
search_params[HINTS] = param[HINTS]

# after 2.5.1, all parameters of search_params can be written into one layer
# no more parameters will be written searchParams.params
# to ensure compatibility and milvus can still get a json format parameter
# try to write all the parameters under searchParams into searchParams.Params
for key, value in search_params.items():
if key in params:
if params[key] != value:
raise ParamError(
message=f"ambiguous parameter: {key}, in search_param: {value}, in search_param.params: {params[key]}"
)
else:
params[key] = value
search_params["params"] = params

req_params = [
common_types.KeyValuePair(key=str(key), value=utils.dumps(value))
for key, value in search_params.items()
Expand Down

0 comments on commit e398893

Please sign in to comment.