diff --git a/pymilvus/client/prepare.py b/pymilvus/client/prepare.py index 586d7e5ae..fc30321a6 100644 --- a/pymilvus/client/prepare.py +++ b/pymilvus/client/prepare.py @@ -939,7 +939,6 @@ def search_requests_with_expr( search_params = { "topk": limit, - "params": params, "round_decimal": round_decimal, "ignore_growing": ignore_growing, } @@ -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()