Skip to content

Conversation

@liliu-z
Copy link
Member

@liliu-z liliu-z commented Jan 13, 2026

issue: #39157
pr: #46937

@sre-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: liliu-z

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

@liliu-z liliu-z changed the title enhance: support search_by_pk for BM25 (#46937) enhance: [2.6]support search_by_pk for BM25 Jan 13, 2026
@sre-ci-robot sre-ci-robot added the size/L Denotes a PR that changes 100-499 lines. label Jan 13, 2026
@gemini-code-assist
Copy link

Summary of Changes

Hello @liliu-z, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the search capabilities by introducing support for search_by_pk operations with BM25 functions. Previously, this functionality was limited to vector fields. The changes involve intelligent detection of BM25 functions within the proxy layer, enabling the system to correctly fetch the necessary text fields for BM25 processing, thereby expanding the flexibility and utility of primary key-based searches for full-text indexing.

Highlights

  • BM25 Search by Primary Key Support: The handleIfSearchByPK function has been enhanced to correctly identify and process BM25 function-based searches, allowing search_by_pk operations to work with BM25.
  • Dynamic Field Retrieval: The system now dynamically determines whether to fetch a vector field (for traditional vector search) or the input text field (for BM25 search) based on the detected function type, ensuring correct data retrieval for search_by_pk.
  • BM25 Function Validation: Added validation to ensure that BM25 functions have at least one input field defined, preventing potential errors during processing.
  • Unit Test Coverage: A new unit test (TestHandleIfSearchByPK_BM25Detection) has been introduced to verify the accurate detection of BM25 functions by their output field ID and type, improving robustness.
  • Python Client Test Update: The Python client's full-text search test case has been updated to reflect the new search_by_pk support for BM25, confirming that such operations now succeed instead of returning an error.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@liliu-z liliu-z changed the title enhance: [2.6]support search_by_pk for BM25 enhance: [2.6][cp]support search_by_pk for BM25 Jan 13, 2026
@sre-ci-robot
Copy link
Contributor

[ci-v2-notice]
Notice: New ci-v2 system is enabled for this PR.

To rerun ci-v2 checks, comment with:

  • /ci-rerun-code-check // for ci-v2/code-check
  • /ci-rerun-build // for ci-v2/build
  • /ci-rerun-ut-integration // for ci-v2/ut-integration, will rerun ci-v2/build
  • /ci-rerun-ut-go // for ci-v2/ut-go, will rerun ci-v2/build
  • /ci-rerun-ut-cpp // for ci-v2/ut-cpp
  • /ci-rerun-ut // for all ci-v2/ut-integration, ci-v2/ut-go, ci-v2/ut-cpp, will rerun ci-v2/build
  • /ci-rerun-e2e-arm // for ci-v2/e2e-arm
  • /ci-rerun-e2e-default // for ci-v2/e2e-default

If you have any questions or requests, please contact @zhikunyao.

@mergify mergify bot added dco-passed DCO check passed. kind/enhancement Issues or changes related to enhancement labels Jan 13, 2026
@sre-ci-robot sre-ci-robot added the do-not-merge/need-milestone generate by v2-label-manager label Jan 13, 2026
@sre-ci-robot
Copy link
Contributor

[INFO] PR Label Summary by Default
[SUCCESS] PR #46937 merged to master

[WARNING] Milestone not set

You can set milestone by commenting:
/set-milestone
Example:
/set-milestone 2.5.0

Use /refresh-label to update related check and label manually

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request enhances Milvus by adding support for search by primary key (PK) for BM25, a feature that was previously unsupported. The changes correctly identify when a search request is for a BM25 field and modify the query to fetch the underlying text data instead of vector data. The Python integration tests have been updated to validate this new functionality. The implementation is solid, and I have one suggestion to improve its robustness.

Comment on lines +3410 to +3413
if len(bm25Function.InputFieldNames) == 0 {
return merr.WrapErrParameterInvalidMsg("BM25 function has no input field")
}
fieldToFetch = bm25Function.InputFieldNames[0]

Choose a reason for hiding this comment

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

high

The current code checks if bm25Function.InputFieldNames is empty, but it doesn't handle the case where there might be more than one input field. While a BM25 function is expected to have a single text input, it would be more robust to enforce this constraint here to prevent unexpected behavior if a misconfigured function is used. I suggest checking for exactly one input field.

Suggested change
if len(bm25Function.InputFieldNames) == 0 {
return merr.WrapErrParameterInvalidMsg("BM25 function has no input field")
}
fieldToFetch = bm25Function.InputFieldNames[0]
if len(bm25Function.InputFieldNames) != 1 {
return merr.WrapErrParameterInvalidMsg(fmt.Sprintf("BM25 function must have exactly one input field, but has %d", len(bm25Function.InputFieldNames)))
}
fieldToFetch = bm25Function.InputFieldNames[0]

@codecov
Copy link

codecov bot commented Jan 13, 2026

Codecov Report

❌ Patch coverage is 56.00000% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.73%. Comparing base (a97d91c) to head (678a8f9).

Files with missing lines Patch % Lines
internal/proxy/impl.go 56.00% 8 Missing and 3 partials ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##              2.6   #47012      +/-   ##
==========================================
+ Coverage   74.51%   76.73%   +2.22%     
==========================================
  Files        1395     1920     +525     
  Lines      217975   300343   +82368     
==========================================
+ Hits       162415   230461   +68046     
- Misses      48127    62451   +14324     
+ Partials     7433     7431       -2     
Components Coverage Δ
Client 78.17% <ø> (ø)
Core 82.58% <ø> (∅)
Go 75.54% <56.00%> (+0.01%) ⬆️
Files with missing lines Coverage Δ
internal/proxy/impl.go 71.13% <56.00%> (-0.03%) ⬇️

... and 549 files with indirect coverage changes

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

@liliu-z
Copy link
Member Author

liliu-z commented Jan 13, 2026

/ci-rerun-code-check

@liliu-z
Copy link
Member Author

liliu-z commented Jan 13, 2026

/ci-rerun-e2e-default

@liliu-z liliu-z force-pushed the support_search_by_pk_for_bm25_2.6 branch from 875ec82 to 678a8f9 Compare January 15, 2026 08:05
@sre-ci-robot
Copy link
Contributor

[INFO] PR Label Summary by Default
[SUCCESS] PR #46937 merged to master

[WARNING] Milestone not set

You can set milestone by commenting:
/set-milestone
Example:
/set-milestone 2.5.0

Use /refresh-label to update related check and label manually

@liliu-z liliu-z modified the milestones: 2.6.9, 2.6.10 Jan 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved area/test dco-passed DCO check passed. do-not-merge/need-milestone generate by v2-label-manager kind/enhancement Issues or changes related to enhancement sig/testing size/L Denotes a PR that changes 100-499 lines.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants