fix: DocumentJoiner concatenate keeps score=0.0 over worse duplicates#11353
Open
Aarkin7 wants to merge 2 commits into
Open
fix: DocumentJoiner concatenate keeps score=0.0 over worse duplicates#11353Aarkin7 wants to merge 2 commits into
Aarkin7 wants to merge 2 commits into
Conversation
Replaces a truthiness check (`if doc.score`) with an explicit `is not None` check when selecting the best-scored document among duplicates in `_concatenate`. Previously `score=0.0` was coerced to `-inf`, causing a negatively-scored duplicate to be kept instead. Applies the same explicit check to `_merge` for consistency; merge behavior is unchanged.
|
@Aarkin7 is attempting to deploy a commit to the deepset Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||||||||||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related Issues
Proposed Changes:
DocumentJoiner._concatenate, replacedoc.score if doc.score else -infwithdoc.score if doc.score is not None else -inf. The truthiness check treatedscore=0.0as unscored, causing a worse-scored duplicate (e.g.score=-0.5) to win during deduplication.is not Nonecheck in_mergefor stylistic consistency with_distribution_based_rank_fusionand thesort_by_scorebranch inrun. Behavior is unchanged in merge mode (Noneand0.0both contribute0).score=0.0vs negatively-scored andNone-scored duplicates in concatenate mode.How did you test it?
test/components/joiners/test_document_joiner.py.hatch run test:unit -- test/components/joiners/test_document_joiner.pylocally.hatch run test:typesandhatch run fmt.Notes for the reviewer
Minimal, surgical fix. One operator on two lines plus tests. No public API or serialization change.
Checklist
fix:,feat:,build:,chore:,ci:,docs:,style:,refactor:,perf:,test:and added!in case the PR includes breaking changes.