Skip to content

Commit

Permalink
enhance: simplify the structure of search_params
Browse files Browse the repository at this point in the history
Signed-off-by: lixinguo <xinguo.li@zilliz.com>
  • Loading branch information
lixinguo committed Dec 25, 2024
1 parent ebcb546 commit dd0b39d
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion pymilvus/client/prepare.py
Original file line number Diff line number Diff line change
Expand Up @@ -939,7 +939,6 @@ def search_requests_with_expr(

search_params = {
"topk": limit,
"params": params,
"round_decimal": round_decimal,
"ignore_growing": ignore_growing,
}
Expand Down Expand Up @@ -979,6 +978,18 @@ 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 and params[key] != value:
raise ParamError(
message=f"ambiguous parameter: {key}, in search_param: {value}, in search_param: {params[key]}"
)
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 dd0b39d

Please sign in to comment.