Skip to content

feat: add IndexParam for index creation and deprecate IndexDesc-based request input - #608

Merged
sre-ci-robot merged 1 commit into
milvus-io:masterfrom
yhmo:ma
Sep 20, 2026
Merged

sre-ci-robot merged 1 commit into
milvus-io:masterfrom
yhmo:ma

Conversation

@yhmo

@yhmo yhmo commented Sep 18, 2026 •

Copy link
Copy Markdown
Collaborator

What this PR does / why we need it

Introduce a dedicated IndexParam type for index-creation input so the C++ SDK matches the Java/Rust SDKs, where createIndex takes IndexParam and describeIndex returns IndexDesc. Previously the C++ SDK reused IndexDesc (the describe type) as the create-index input.

What changes

  • New public type milvus::IndexParam (src/include/milvus/types/IndexParam.h): creation-only fields field_name/index_name/index_type/metric_type/extra_params.
  • CreateIndexRequest and CreateCollectionRequest (inline index creation) gain IndexParams() / SetIndexParams() / WithIndexParams() / AddIndexParam() to build multiple indexes from IndexParam.
  • The previous IndexDesc-based accessors (Indexes() / SetIndexes() / WithIndexes() / AddIndex()) are marked [[deprecated]] but remain functional: deprecated setters forward into the IndexParam list, and the deprecated Indexes() getter derives the IndexDesc view on demand, so existing callers keep working without a source break (single source of truth).
  • MilvusClientV2::CreateIndex / CreateCollection signatures are unchanged; the impl builds the create-index RPC from IndexParam entries.
  • Examples, tutorials, and unit/mocked/system tests updated to the new accessors.

Verification

  • testing-ut: 923 tests passed
  • testing-it (mocked): CreateIndex/CreateCollection suites passed
  • testing-st (system tests) compiles
  • All 40 V2 examples build
  • All 6 tutorials compile against the PR SDK
  • All changed files pass clang-format

Notes

  • AddFunctionFieldRequest::WithIndex still uses IndexDesc (unchanged).
  • The deprecated Indexes() getter on CreateIndexRequest/CreateCollectionRequest returns by value (previously a const&). auto& v = req.Indexes(); no longer compiles and const auto& v now binds a snapshot rather than a live view; code should migrate to IndexParams(). Updating the deprecated accessors' shape is intentional so the two getters share one source of truth.
  • Removing the deprecated accessors is left to a future major version.

Copilot AI lite review requested due to automatic review settings September 18, 2026 06:13
@sre-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: yhmo

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@mergify

mergify Bot commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

@codecov

codecov Bot commented Sep 18, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.19626% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.69%. Comparing base (a0592aa) to head (9bf2444).
⚠️ Report is 165 commits behind head on master.

Files with missing lines Patch % Lines
src/impl/MilvusClientV2Impl.cpp 90.00% 2 Missing ⚠️
src/impl/utils/IndexUtils.h 90.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           master     #608       +/-   ##
===========================================
+ Coverage   53.47%   89.69%   +36.22%     
===========================================
  Files          52      391      +339     
  Lines        4432    16722    +12290     
  Branches        0     1841     +1841     
===========================================
+ Hits         2370    14999    +12629     
+ Misses       2062     1723      -339     
Files with missing lines Coverage Δ
src/impl/MilvusClientV2Impl.h 100.00% <ø> (ø)
...mpl/request/collection/CreateCollectionRequest.cpp 97.02% <100.00%> (ø)
src/impl/request/index/CreateIndexRequest.cpp 100.00% <100.00%> (ø)
src/impl/types/IndexParam.cpp 100.00% <100.00%> (ø)
...ilvus/request/collection/CreateCollectionRequest.h 100.00% <ø> (ø)
.../include/milvus/request/index/CreateIndexRequest.h 100.00% <ø> (ø)
src/impl/utils/IndexUtils.h 90.00% <90.00%> (ø)
src/impl/MilvusClientV2Impl.cpp 88.27% <90.00%> (ø)

... and 400 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread src/include/milvus/request/index/CreateIndexRequest.h Outdated
Comment thread src/impl/request/index/CreateIndexRequest.cpp
Comment thread test/it/v2/TestIndex.cpp
Comment thread tutorial/1_quickstart/src/main.cpp
Comment thread tutorial/2_collection/src/main.cpp
Comment thread tutorial/5_dml/src/main.cpp
Comment thread tutorial/6_dql/src/main.cpp Outdated
@yhmo
yhmo force-pushed the ma branch 2 times, most recently from a239d11 to 89bb492 Compare September 18, 2026 08:20
@yhmo yhmo changed the title feat: add IndexParam for CreateIndex and deprecate IndexDesc-based request input feat: add IndexParam for index creation and deprecate IndexDesc-based request input Sep 18, 2026
Comment thread src/impl/request/collection/CreateCollectionRequest.cpp Outdated
Comment thread src/impl/request/index/CreateIndexRequest.cpp Outdated
Comment thread test/it/v2/TestIndex.cpp
Comment thread src/include/milvus/types/IndexParam.h Outdated
@yhmo
yhmo force-pushed the ma branch 2 times, most recently from 18d121a to 1934fcb Compare September 20, 2026 06:39
@mergify mergify Bot added the ci-passed label Sep 20, 2026
Comment thread examples/src/v2/general.cpp Outdated
Comment thread src/impl/MilvusClientV2Impl.cpp Outdated
Comment thread src/include/milvus/request/index/CreateIndexRequest.h
… request input

Signed-off-by: yhmo <yihua.mo@zilliz.com>
@mergify mergify Bot added ci-passed and removed ci-passed labels Sep 20, 2026
@yhmo yhmo added the lgtm label Sep 20, 2026
@sre-ci-robot
sre-ci-robot merged commit 3b42785 into milvus-io:master Sep 20, 2026
12 checks passed
@yhmo
yhmo deleted the ma branch September 20, 2026 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants