Skip to content

fix(milvus2): serialize range search parameters as ANN params - #926

Open
tonghzhang wants to merge 1 commit into
cloudwego:mainfrom
tonghzhang:fix/milvus2-range-search-params-v2
Open

fix(milvus2): serialize range search parameters as ANN params#926
tonghzhang wants to merge 1 commit into
cloudwego:mainfrom
tonghzhang:fix/milvus2-range-search-params-v2

Conversation

@tonghzhang

Copy link
Copy Markdown

What type of PR is this?

fix, tests

Check the PR title.

  • This PR title match the format: <type>(optional scope): <description>
  • The description of this PR title is user-oriented and clear enough for others to understand.
  • Attach the PR updating the user documentation if the current PR requires user awareness at the usage level. User docs repo

(Optional) Translate the PR title into Chinese.

fix: 修复范围搜索参数未正确生效的问题

(Optional) More detailed description for this PR(en: English/zh: Chinese).

en:
This fixes #893

Summary

Fixes Milvus range search parameter serialization.

Previously, radius and range_filter were serialized as top-level search parameters, leaving the ANN params object empty. Since Milvus expects these range constraints inside ANN params, the configured range filter was not applied correctly.

Changes

Build range search parameters with index.CustomAnnParam.
Pass the parameters through WithAnnParam.
Serialize radius and the optional range_filter inside the ANN params object.
Add regression assertions to TestRange_BuildSearchOption.
Verify that radius and range_filter are not present as top-level search parameters.

Tests

go build ./search_mode — PASS
go vet -tests=false ./search_mode — PASS
go test ./search_mode — not completed locally on Windows because of a mockey v1.4.0 runtime compatibility issue

Automatically closes linked issue when PR is merged.
Eg: Fixes #<issue number>, or Fixes (paste link of issue).

(optional) The PR that updates user documentation:

@CLAassistant

CLAassistant commented Jul 21, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Milvus2 retriever 范围搜索参数序列化错误

2 participants