Skip to content

Fix scores when document has no text - [MOD-9423]#5958

Merged
oshadmi merged 2 commits intomasterfrom
guyav-MOD-9423
Apr 20, 2025
Merged

Fix scores when document has no text - [MOD-9423]#5958
oshadmi merged 2 commits intomasterfrom
guyav-MOD-9423

Conversation

@GuyAv46
Copy link
Collaborator

@GuyAv46 GuyAv46 commented Apr 19, 2025

Describe the changes in the pull request

Fix an edge case where the document has no text at all, causing its maxFreq and len to be zero, and attempting to use this values to normalize the scores yields inf for non-zero scores, and nan for zero scores (x/0 and 0/0 respectively). This causes the obviously not matching document to score very high, yielding meaningless results that are preferred over better matches, or just messing with the sorting when comparing scores to nan

Mark if applicable

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

@codecov
Copy link

codecov bot commented Apr 19, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.06%. Comparing base (7e410ec) to head (1894f8e).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5958      +/-   ##
==========================================
- Coverage   87.08%   87.06%   -0.03%     
==========================================
  Files         211      211              
  Lines       38592    38595       +3     
  Branches     1893     1893              
==========================================
- Hits        33609    33601       -8     
- Misses       4976     4987      +11     
  Partials        7        7              

☔ 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.

@GuyAv46 GuyAv46 enabled auto-merge April 19, 2025 12:05
@oshadmi oshadmi requested a review from kei-nan April 20, 2025 10:46
@GuyAv46 GuyAv46 added this pull request to the merge queue Apr 20, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 20, 2025
@oshadmi oshadmi added this pull request to the merge queue Apr 20, 2025
Merged via the queue into master with commit 3588904 Apr 20, 2025
12 checks passed
@oshadmi oshadmi deleted the guyav-MOD-9423 branch April 20, 2025 12:42
@redisearch-backport-pull-request
Copy link
Contributor

Backport failed for 2.8, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin 2.8
git worktree add -d .worktree/backport-5958-to-2.8 origin/2.8
cd .worktree/backport-5958-to-2.8
git switch --create backport-5958-to-2.8
git cherry-pick -x 3588904e07656de9bbf6ad7b6e997f65f57396fa

@redisearch-backport-pull-request
Copy link
Contributor

Backport failed for 2.6, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin 2.6
git worktree add -d .worktree/backport-5958-to-2.6 origin/2.6
cd .worktree/backport-5958-to-2.6
git switch --create backport-5958-to-2.6
git cherry-pick -x 3588904e07656de9bbf6ad7b6e997f65f57396fa

@redisearch-backport-pull-request
Copy link
Contributor

Backport failed for 2.10, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin 2.10
git worktree add -d .worktree/backport-5958-to-2.10 origin/2.10
cd .worktree/backport-5958-to-2.10
git switch --create backport-5958-to-2.10
git cherry-pick -x 3588904e07656de9bbf6ad7b6e997f65f57396fa

redisearch-backport-pull-request bot pushed a commit that referenced this pull request Apr 20, 2025
* fix scorers

* add a test

(cherry picked from commit 3588904)
@redisearch-backport-pull-request
Copy link
Contributor

Successfully created backport PR for 8.0:

github-merge-queue bot pushed a commit that referenced this pull request Apr 20, 2025
Fix scores when document has no text - [MOD-9423] (#5958)

* fix scorers

* add a test

(cherry picked from commit 3588904)

Co-authored-by: GuyAv46 <[email protected]>
GuyAv46 added a commit that referenced this pull request Apr 20, 2025
* fix scorers

* add a test

(cherry picked from commit 3588904)
GuyAv46 added a commit that referenced this pull request Apr 20, 2025
* fix scorers

* add a test

(cherry picked from commit 3588904)
GuyAv46 added a commit that referenced this pull request Apr 20, 2025
* fix scorers

* add a test

(cherry picked from commit 3588904)
github-merge-queue bot pushed a commit that referenced this pull request Apr 27, 2025
* Fix scores when document has no text - [MOD-9423] (#5958)

* fix scorers

* add a test

(cherry picked from commit 3588904)

* fix test for 2.8

* fix another bad scoring
github-merge-queue bot pushed a commit that referenced this pull request Apr 27, 2025
* Fix scores when document has no text - [MOD-9423] (#5958)

* fix scorers

* add a test

(cherry picked from commit 3588904)

* fix bad tests for 2.10

* fix another bad score
github-merge-queue bot pushed a commit that referenced this pull request Apr 27, 2025
Fix scores when document has no text - [MOD-9423] (#5958)

* fix scorers

* add a test

(cherry picked from commit 3588904)
JoanFM pushed a commit that referenced this pull request May 27, 2025
JoanFM pushed a commit that referenced this pull request May 27, 2025
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