Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhance: simplify the structure of search_params #2507

Merged
merged 1 commit into from
Dec 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading