Skip to content

[2.8] [MOD-10037] add default scorer in configuration (#7065)#7086

Merged
JoanFM merged 15 commits into2.8from
backport-7065-to-2.8
Oct 29, 2025
Merged

[2.8] [MOD-10037] add default scorer in configuration (#7065)#7086
JoanFM merged 15 commits into2.8from
backport-7065-to-2.8

Conversation

@JoanFM
Copy link
Collaborator

@JoanFM JoanFM commented Oct 17, 2025

  • feat: add default scorer in configuration

  • fix and test config setters and getters

  • test: add flow tests checking scorer behavior

  • fix: fix as per cursor comments

  • fix: fix as per code review

  • fix: change the init config code

  • test: fix the tests

  • test: refactor tests

  • fix memory leak in getter

  • test: add explicit test BM25STD is the default since start

  • validate default scorer at module init

  • fix validation against extensions

  • apply changes as per review

  • Update tests/cpptests/test_cpp_forkgc.cpp

  • refactor small setter

  • try to fix sanitizer leak

  • test: Known leaks when onModuleLoad fails

  • Update src/module-init/module-init.c


Backport of #7065 to 2.8.
(cherry picked from commit b61c075)

Describe the changes in the pull request

A clear and concise description of what the PR is solving, including:

  1. Current: The current state briefly
  2. Change: What is the change
  3. Outcome: Adding the outcome

Which additional issues this PR fixes

  1. MOD-...
  2. #...

Main objects this PR modified

  1. ...

Mark if applicable

  • This PR introduces API changes
  • This PR introduces serialization changes

Note

Introduce DEFAULT_SCORER config (gated by ENABLE_UNSTABLE_FEATURES), validate against registered scorers, use it as the default across search/aggregate, and add tests and info/LLAPI updates.

  • Configuration:
    • Add DEFAULT_SCORER config (requires ENABLE_UNSTABLE_FEATURES) with setters/getters and validation via Extensions_GetScoringFunction.
    • Track in RSConfig (defaultScorer) and include in FT.CONFIG GET * and INFO output.
    • Add ENABLE_UNSTABLE_FEATURES runtime flag.
  • Initialization & Extensions:
    • Initialize RSGlobalConfig.defaultScorer to DEFAULT_SCORER_NAME on load; validate selected scorer at startup.
    • Add Extensions_InitDone() helper.
  • Query/Execution Path:
    • Use RSGlobalConfig.defaultScorer when no SCORER specified in FT.SEARCH/FT.AGGREGATE and LLAPI.
    • Replace hardcoded defaults in scorer selection (aggregate_request.c, query_optimizer.c, redisearch_api.c).
  • Info/Diagnostics:
    • Expose default_scorer in INFO and config dump strings.
  • Tests/Mocks:
    • Add Python tests for default scorer behavior, config gating, and startup validation.
    • Update C++ tests/mocks to set/reset defaultScorer during bootstrap/shutdown.

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

* feat: add default scorer in configuration

* fix and test config setters and getters

* test: add flow tests checking scorer behavior

* fix: fix as per cursor comments

* fix: fix as per code review

* fix: change the init config code

* test: fix the tests

* test: refactor tests

* fix memory leak in getter

* test: add explicit test BM25STD is the default since start

* validate default scorer at module init

* fix validation against extensions

* apply changes as per review

* Update tests/cpptests/test_cpp_forkgc.cpp

* refactor small setter

* try to fix sanitizer leak

* test: Known leaks when onModuleLoad fails

* Update src/module-init/module-init.c

Co-authored-by: kei-nan <[email protected]>

---------

Co-authored-by: kei-nan <[email protected]>
(cherry picked from commit b61c075)
@JoanFM JoanFM requested review from Itzikvaknin and kei-nan and removed request for Itzikvaknin October 17, 2025 10:00
cursor[bot]

This comment was marked as outdated.

@JoanFM JoanFM force-pushed the backport-7065-to-2.8 branch from 264db4f to 240c4fa Compare October 17, 2025 10:04
@JoanFM JoanFM force-pushed the backport-7065-to-2.8 branch from 4ad907f to b3bbf9f Compare October 17, 2025 10:09
cursor[bot]

This comment was marked as outdated.

@codecov
Copy link

codecov bot commented Oct 17, 2025

Codecov Report

❌ Patch coverage is 91.66667% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.44%. Comparing base (11147c8) to head (edb80f6).
⚠️ Report is 4 commits behind head on 2.8.

Files with missing lines Patch % Lines
src/query_optimizer.c 33.33% 2 Missing ⚠️
src/aggregate/aggregate_request.c 85.71% 1 Missing ⚠️
src/config.c 95.83% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              2.8    #7086      +/-   ##
==========================================
- Coverage   87.49%   87.44%   -0.06%     
==========================================
  Files         203      203              
  Lines       35636    34791     -845     
==========================================
- Hits        31181    30422     -759     
+ Misses       4455     4369      -86     
Flag Coverage Δ
flow 81.81% <85.41%> (-0.23%) ⬇️
unit 42.50% <16.66%> (-0.25%) ⬇️

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.

cursor[bot]

This comment was marked as outdated.

@JoanFM JoanFM requested a review from Itzikvaknin October 17, 2025 12:28
@JoanFM JoanFM requested a review from oshadmi October 22, 2025 11:00
@JoanFM JoanFM requested a review from nafraf October 27, 2025 17:14
cursor[bot]

This comment was marked as outdated.

nafraf
nafraf previously approved these changes Oct 28, 2025
@JoanFM JoanFM added this pull request to the merge queue Oct 28, 2025
@JoanFM JoanFM removed this pull request from the merge queue due to a manual request Oct 28, 2025
@JoanFM JoanFM added this pull request to the merge queue Oct 28, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 28, 2025
@JoanFM JoanFM added this pull request to the merge queue Oct 28, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 28, 2025
@JoanFM JoanFM added this pull request to the merge queue Oct 28, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 28, 2025
@JoanFM JoanFM added this pull request to the merge queue Oct 29, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 29, 2025
@JoanFM JoanFM added this pull request to the merge queue Oct 29, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 29, 2025
@JoanFM JoanFM added this pull request to the merge queue Oct 29, 2025
Merged via the queue into 2.8 with commit a0a8414 Oct 29, 2025
13 checks passed
@JoanFM JoanFM deleted the backport-7065-to-2.8 branch October 29, 2025 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants