Support OrderBy for search/query#1937
Conversation
|
[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 DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
Tick the box to add this pull request to the merge queue (same as
|
There was a problem hiding this comment.
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 toQueryReqandSearchReq. - Serialized
orderByFieldsintoConstant.ORDER_BY_FIELDSfor 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.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #1937 +/- ##
=========================================
Coverage ? 62.96%
Complexity ? 3998
=========================================
Files ? 467
Lines ? 25806
Branches ? 2375
=========================================
Hits ? 16249
Misses ? 8222
Partials ? 1335
🚀 New features to boost your workflow:
|
Signed-off-by: yhmo <yihua.mo@zilliz.com>
No description provided.