Skip to content

add: COSINE metric and text sparse search#92

Open
BenLocal wants to merge 1 commit intomilvus-io:mainfrom
BenLocal:self
Open

add: COSINE metric and text sparse search#92
BenLocal wants to merge 1 commit intomilvus-io:mainfrom
BenLocal:self

Conversation

@BenLocal
Copy link

@BenLocal BenLocal commented Mar 5, 2025

  • Added COSINE metric type for vector similarity search
  • Added text sparse search
  • upgrade milvus-proto to master version

Add convenient constructor methods for FieldSchema to support all data types:
- Basic types: bool, int8/16/32/64, float, double, string
- Primary key types with auto_id support
- Vector types: binary vector, float vector, sparse float vector
- VarChar with max_length validation

feat: add COSINE metric type and enhance test coverage

- Add COSINE to MetricType enum for vector similarity search
- Update test cases to cover both L2 and COSINE metric types
- Add vector field to client test schema
- Update .gitignore to exclude volumes directory
- Change test server URL from localhost to 127.0.0.1
- Clean up docker-compose configuration

This commit extends the SDK's metric type support and improves test coverage
by running tests with multiple metric types. The changes also include some
infrastructure improvements for better test reliability.

upgrade: milvus-proto

feat: add builder pattern and fix missing proto fields

- Add derive(Builder) pattern support for protobuf message structs
- Add clippy::derive_partial_eq_without_eq attributes to proto messages
- Fix missing fields in collection operations:
  - Add load_fields and skip_load_dynamic_field to LoadCollectionRequest
  - Add major_compaction, collection_name, db_name to ManualCompactionRequest
  - Add valid_data field to FieldData
  - Add schema_timestamp to Insert/Upsert requests
  - Add consistency_level and expr_template_values to Delete request

This commit improves code generation and completes missing proto fields required
by the latest Milvus protocol.

init default values

add new_sparse_float_vector function

feat(collection): implement collection management and operations

- Add collection example demonstrating basic usage
- Implement collection schema builder with field configuration
- Add support for collection operations (upsert, search, range search)
- Include test cases for collection functionality
- Add options for collection creation and loading

fix(test): adjust range search test for different metric types

- Remove unnecessary flush calls in collection tests
- Add metric-specific thresholds for L2 and COSINE distance
- Update range filter assertions to match metric type expectations
- Handle L2 and COSINE metrics separately in range search validation

test: Add text search validation with score threshold

Add test case to verify text search functionality in collection tests.
The test ensures search results meet minimum score threshold (>=0.2)
and validates correct field name handling for text fields.

chore: update .gitignore and improve code formatting

- Add .vscode/ to .gitignore
- Improve README.md formatting and update code examples
- Format test module code for better readability

refactor: improve code formatting and test cleanup

- Format Rust code for better readability across test files
- Add proper collection cleanup in

add debug derive
@sre-ci-robot sre-ci-robot requested review from congqixia and yah01 March 5, 2025 12:05
@sre-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: BenLocal
To complete the pull request process, please assign congqixia after the PR has been reviewed.
You can assign the PR to them by writing /assign @congqixia in a comment when ready.

The full list of commands accepted by this bot can be found 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

@sre-ci-robot
Copy link
Collaborator

Welcome @BenLocal! It looks like this is your first PR to milvus-io/milvus-sdk-rust 🎉

@mergify
Copy link

mergify bot commented Mar 5, 2025

@BenLocal Thanks for your contribution. Please submit with DCO, see the contributing guide https://github.com/milvus-io/milvus/blob/master/CONTRIBUTING.md#developer-certificate-of-origin-dco.

@mergify mergify bot added the needs-dco label Mar 5, 2025
@mergify
Copy link

mergify bot commented Mar 5, 2025

@BenLocal Please associate the related issue to the body of your Pull Request. (eg. “issue: #187”)

@kyoungrok0517
Copy link

We need this :) hope this merges soon

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