Skip to content

feat: Add BM25 field tags to the Milvus online store - #7144

Merged
ntkathole merged 3 commits into
feast-dev:masterfrom
jiwidi:feat/milvus-bm25-tags
Nov 13, 2026
Merged

ntkathole merged 3 commits into
feast-dev:masterfrom
jiwidi:feat/milvus-bm25-tags

Conversation

@jiwidi

@jiwidi jiwidi commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:

Builds on #7143, which adds text analysis tags. A String feature can now declare a BM25
index, which Feast creates with the collection:

Field(
    name="title",
    dtype=String,
    tags={
        "milvus.bm25": "true",
        "milvus.bm25_index_params": '{"inverted_index_algo": "TAAT_NAIVE", "bm25_b": 0.3}',
    },
),
  • milvus.bm25: "true" adds a SPARSE_FLOAT_VECTOR field <field>_bm25, a BM25 function
    <field>_bm25_fn and a SPARSE_INVERTED_INDEX bm25_index_<field>. Names are derived from the
    field, as for scalar_index_<field> and vector_index_<field>.
  • milvus.bm25_index_params passes a JSON object of build parameters to that index.
  • Writes leave <field>_bm25 to Milvus: PyMilvus rejects rows that carry a function output.
  • A view whose only vector is a BM25 output gets no _placeholder_vector.
  • A feature named like a BM25 output is rejected (PyMilvus accepts duplicate field names).
  • Retrieval change: retrieve_online_documents_v2 now names the only dense vector field even
    when it is not a requested feature. Before, Feast passed no anns_field and Milvus inferred
    it, which fails with "multiple anns_fields exist" once the collection also has a BM25 output.
    No behaviour change for collections without one.
  • Feast does not search the BM25 output yet; clients that query Milvus directly can. A
    follow-up can add BM25 and hybrid search to retrieve_online_documents_v2.
  • An existing collection without the output is reported by the existing schema check, and one
    without the index by the missing-index warning.

Which issue(s) this PR fixes:

N/A

Checks

  • I've made sure the tests are passing.
  • My commits are signed off (git commit -s)
  • My PR title follows conventional commits format

Testing Strategy

  • Unit tests

  • Integration tests

  • Manual tests

  • Testing is not required for this change

  • Unit: the created output, function, index and build params; no placeholder; validation;
    writes and re-writes through a fresh store on Milvus Lite (fails without the write change);
    the named anns_field (fails without the retrieval change).

  • Integration (test_milvus_remote.py, against Milvus 2.5.27, 2.6.27 and 3.0.2): the server stores the
    index params, writes succeed, and a BM25 search on <field>_bm25 finds the row.

  • Milvus Lite does not reproduce the anns_field ambiguity, so the unit test checks the argument
    Feast passes.

Misc

Stacked on #7143, whose commit is included here until it merges; review the last commit.
Written with @jonasfagerlund, who is a co-author of the commit.

@jiwidi
jiwidi requested a review from a team as a code owner November 12, 2026 15:21
@codecov-commenter

codecov-commenter commented Nov 12, 2026 •

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 98.03922% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 52.35%. Comparing base (021e9af) to head (288c05e).

Files with missing lines Patch % Lines
.../infra/online_stores/milvus_online_store/milvus.py 98.03% 0 Missing and 1 partial ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #7144      +/-   ##
==========================================
+ Coverage   52.32%   52.35%   +0.02%     
==========================================
  Files         459      459              
  Lines       58095    58131      +36     
  Branches     8560     8568       +8     
==========================================
+ Hits        30397    30432      +35     
  Misses      25614    25614              
- Partials     2084     2085       +1     
Flag Coverage Δ
go-feature-server 30.96% <ø> (ø)
python-unit 53.85% <98.03%> (+0.02%) ⬆️
Files with missing lines Coverage Δ
.../infra/online_stores/milvus_online_store/milvus.py 89.10% <98.03%> (+0.42%) ⬆️

Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 021e9af...288c05e. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

jiwidi and others added 2 commits November 13, 2026 15:01
The milvus.analyzer_params and milvus.enable_match field tags set the
analyzer and TEXT_MATCH on a String feature when Feast creates the
collection. Feast does not query the tokens; clients that query Milvus
directly can.

Co-authored-by: jonasfagerlund <jonashfagerlund@gmail.com>
Signed-off-by: jonasfagerlund <jonashfagerlund@gmail.com>
Signed-off-by: jiwidi <fhjaime96@gmail.com>
milvus.bm25 on a String feature makes Feast add a sparse output, a BM25
function and its index when it creates the collection, and
milvus.bm25_index_params sets that index's build parameters. Writes leave
the output to Milvus, and searches name the dense vector field, which
Milvus can no longer infer once the collection has a BM25 output.

Co-authored-by: jonasfagerlund <jonashfagerlund@gmail.com>
Signed-off-by: jonasfagerlund <jonashfagerlund@gmail.com>
Signed-off-by: jiwidi <fhjaime96@gmail.com>
Signed-off-by: jiwidi <fhjaime96@gmail.com>
@ntkathole
ntkathole merged commit 001d4a6 into feast-dev:master Nov 13, 2026
23 of 24 checks passed
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