Skip to content

[8.4] MOD-12223: Fix BM25STD underflow wraparound#7256

Merged
redisearch-backport-pull-request[bot] merged 1 commit into8.4from
backport-7223-to-8.4
Nov 9, 2025
Merged

[8.4] MOD-12223: Fix BM25STD underflow wraparound#7256
redisearch-backport-pull-request[bot] merged 1 commit into8.4from
backport-7223-to-8.4

Conversation

@redisearch-backport-pull-request
Copy link
Contributor

@redisearch-backport-pull-request redisearch-backport-pull-request bot commented Nov 9, 2025

Description

Backport of #7223 to 8.4.


Note

Prevent underflow in BM25STD IDF calculation and add a targeted test; adjust test skips and remove an obsolete scorer test.

  • Scoring (BM25STD):
    • Clamp totalDocs in CalculateIDF_BM25 to MAX(totalDocs, termDocs) to avoid underflow in IDF (src/iterators/inverted_index_iterator.c).
  • Tests:
    • Add testBM25STDUnderflow to validate stable BM25STD scoring under stale inverted-index entries (tests/pytests/test_scorers.py).
    • Remove testScoreReplace from tests/pytests/test_scorers.py.
    • Update skip conditions for testLazyTextFieldExpiration to also skip in cluster mode (tests/pytests/test_expire.py).

Written by Cursor Bugbot for commit 6f45d46. This will update automatically on new commits. Configure here.

* Fix BM25STD underflow wraparound

* Fix comment

* Fix documentation and tweak test

* Address review

* Remove old test

* Skip cluster on expiration test

* Fix leak in test

(cherry picked from commit d95056f)
@codecov
Copy link

codecov bot commented Nov 9, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.63%. Comparing base (cbd0b5e) to head (6f45d46).
⚠️ Report is 1 commits behind head on 8.4.

Additional details and impacted files
@@            Coverage Diff             @@
##              8.4    #7256      +/-   ##
==========================================
- Coverage   85.66%   85.63%   -0.04%     
==========================================
  Files         326      326              
  Lines       50942    50943       +1     
  Branches    10921    10921              
==========================================
- Hits        43638    43623      -15     
- Misses       7138     7154      +16     
  Partials      166      166              
Flag Coverage Δ
flow 84.18% <100.00%> (-0.15%) ⬇️
unit 51.73% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

@redisearch-backport-pull-request redisearch-backport-pull-request bot added this pull request to the merge queue Nov 9, 2025
Merged via the queue into 8.4 with commit a895366 Nov 9, 2025
22 checks passed
@redisearch-backport-pull-request redisearch-backport-pull-request bot deleted the backport-7223-to-8.4 branch November 9, 2025 11:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant