Skip to content

Support OrderBy for search/query#1937

Merged
sre-ci-robot merged 1 commit into
milvus-io:masterfrom
yhmo:mm
Jul 10, 2026
Merged

Support OrderBy for search/query#1937
sre-ci-robot merged 1 commit into
milvus-io:masterfrom
yhmo:mm

Conversation

@yhmo

@yhmo yhmo commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings July 10, 2026 04:08
@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

@mergify

mergify Bot commented Jul 10, 2026

Copy link
Copy Markdown

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

  • Queue this pull request

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.

Pull request overview

Adds client-side support for order_by_fields on v2 search and query by introducing a typed OrderByField model, wiring it into request builders, and serializing it into the underlying gRPC request parameters.

Changes:

  • Introduced OrderByField (field name + direction with default ASC) and added it to QueryReq and SearchReq.
  • Serialized orderByFields into Constant.ORDER_BY_FIELDS for both query and search gRPC requests.
  • Added unit tests for serialization and an end-to-end example demonstrating usage.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
sdk-core/src/test/java/io/milvus/v2/service/vector/VectorTest.java Adds tests validating order_by_fields serialization for query/search and default direction behavior.
sdk-core/src/main/java/io/milvus/v2/utils/VectorUtils.java Serializes orderByFields into gRPC params via order_by_fields.
sdk-core/src/main/java/io/milvus/v2/service/vector/request/SearchReq.java Adds orderByFields to the search request model and builder.
sdk-core/src/main/java/io/milvus/v2/service/vector/request/QueryReq.java Adds orderByFields to the query request model and builder.
sdk-core/src/main/java/io/milvus/v2/service/vector/request/aggregation/OrderByField.java New value object + builder for specifying per-field ordering.
sdk-core/src/main/java/io/milvus/v2/client/MilvusClientV2Session.java Ensures session copies preserve orderByFields for query/search.
sdk-core/src/main/java/io/milvus/param/Constant.java Adds ORDER_BY_FIELDS constant key.
examples/src/main/java/io/milvus/v2/OrderByExample.java New example demonstrating order_by_fields for search and query.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread examples/src/main/java/io/milvus/v2/OrderByExample.java Outdated
@codecov

codecov Bot commented Jul 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 82.35294% with 9 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (master@cd9776f). Learn more about missing BASE report.

Files with missing lines Patch % Lines
...rvice/vector/request/aggregation/OrderByField.java 76.19% 3 Missing and 2 partials ⚠️
.../io/milvus/v2/service/vector/request/QueryReq.java 71.42% 2 Missing ⚠️
...io/milvus/v2/service/vector/request/SearchReq.java 71.42% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #1937   +/-   ##
=========================================
  Coverage          ?   62.96%           
  Complexity        ?     3998           
=========================================
  Files             ?      467           
  Lines             ?    25806           
  Branches          ?     2375           
=========================================
  Hits              ?    16249           
  Misses            ?     8222           
  Partials          ?     1335           
Files with missing lines Coverage Δ
...k-core/src/main/java/io/milvus/param/Constant.java 90.00% <ø> (ø)
...ava/io/milvus/v2/client/MilvusClientV2Session.java 59.62% <100.00%> (ø)
.../src/main/java/io/milvus/v2/utils/VectorUtils.java 58.36% <100.00%> (ø)
.../io/milvus/v2/service/vector/request/QueryReq.java 78.64% <71.42%> (ø)
...io/milvus/v2/service/vector/request/SearchReq.java 71.79% <71.42%> (ø)
...rvice/vector/request/aggregation/OrderByField.java 76.19% <76.19%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread sdk-core/src/main/java/io/milvus/v2/utils/VectorUtils.java
Signed-off-by: yhmo <yihua.mo@zilliz.com>
@mergify mergify Bot removed the ci-passed label Jul 10, 2026
@yhmo yhmo added the lgtm label Jul 10, 2026
@mergify mergify Bot added the ci-passed label Jul 10, 2026
@sre-ci-robot sre-ci-robot merged commit 00d5f35 into milvus-io:master Jul 10, 2026
8 checks passed
@yhmo yhmo deleted the mm branch July 10, 2026 06:48
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.

4 participants