GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix: reject NaN scores in MetaFieldRanker linear_score mode by simin-yuan · Pull Request #13583 · deepset-ai/haystack

Conversation

@simin-yuan

@simin-yuan simin-yuan commented Nov 6, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Related Issues

  • No issue was filed for this one: it is a one-line fix in the same family as fix: reject NaN weights in MetaFieldRanker #13508 and fix: reject NaN/inf weights in DocumentJoiner #13410.

Proposed Changes:

MetaFieldRanker in linear_score mode is meant to warn and default a document's score to 0 when that score is outside [0, 1]. The check read document.score < 0 or document.score > 1, and a NaN passes it — every comparison with NaN is False. The NaN therefore went into the weighted sum and became the sort key, so the document was ordered by a comparison that always evaluates to False. No exception, no warning.

The check is now not 0 <= document.score <= 1, the same form #13508 (MetaFieldRanker weight) and #13410 (DocumentJoiner weights) were changed to, for the same reason.

How did you test it?

test_linear_score_raises_warning_if_doc_wrong_score was already parametrized with out-of-range scores; float("nan") is now one of them.

  • Before the change: 1 failed, 4 passed — only the [nan] case fails, because the warning is never logged.
  • After the change: test/components/rankers/ → 171 passed, 3 skipped.

Manual check with three documents scored nan, 0.9, 0.1:

returned order
before nan document first, score nan, no warning
after nan document last, score 0.0, existing warning logged

Notes for the reviewer

No behaviour change for valid scores. inf was already caught by the old check and still is; the guard is now written in the not a <= x <= b form the two recent NaN fixes use, so NaN cannot slip through again if the bounds change.

Checklist

  • I have read the contributors guidelines and the code of conduct.
  • I have updated the related issue with new insights and changes. No related issue exists.
  • I have added unit tests and updated the docstrings. (test case added; docstrings unchanged because behaviour for valid scores is unchanged)
  • I've used one of the conventional commit types for my PR title: fix:.
  • I have documented my code.
  • I have added a release note file, following the contributors guidelines.
  • I have run pre-commit hooks and fixed any issue. (ran ruff check and ruff format --check on the two changed files: both clean)

This PR was generated with an AI assistant. I reviewed the change and ran the tests above.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@simin-yuan
fix: reject NaN scores in MetaFieldRanker linear_score mode
e2af1ad
@simin-yuan
simin-yuan requested a review from a team as a code owner November 6, 2026 08:17
@simin-yuan
simin-yuan requested review from sjrl and removed request for a team November 6, 2026 08:17
@vercel

vercel Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

@simin-yuan is attempting to deploy a commit to the deepset Team on Vercel.

A member of the Team first needs to authorize it.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@CLAassistant

CLAassistant commented Nov 6, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot added the topic:tests label Nov 6, 2026
@sjrl sjrl self-assigned this Nov 6, 2026
@github-actions github-actions Bot added the type:documentation Improvements on the docs label Nov 6, 2026
sjrl
sjrl reviewed Nov 6, 2026
View reviewed changes
Comment thread releasenotes/notes/reject-nan-scores-metafield-linear-8350e9de3cad3023.yaml Resolved

Uh oh!

There was an error while loading. Please reload this page.

@sjrl

sjrl commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Thanks for the PR! Could you please sign the CLA (see the CLAassistant comment above) so we can merge this?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@simin-yuan
docs: use the reviewer's shorter wording for the release note
2fe8d76
@github-actions

github-actions Bot commented Nov 6, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  haystack/components/joiners
  list_joiner.py
  haystack/components/rankers
  meta_field.py
  haystack/hooks/human_in_the_loop
  strategies.py
  haystack/tools
  from_function.py
Project Total  

This report was generated by python-coverage-comment-action

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@simin-yuan

simin-yuan commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author

Signed the CLA and applied the release note suggestion. Thanks for the quick review!

sjrl reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

sjrl
sjrl approved these changes Nov 6, 2026
View reviewed changes

@sjrl sjrl left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@sjrl
sjrl merged commit d140a4e into deepset-ai:main Nov 6, 2026
22 of 23 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@chrikrah chrikrah mentioned this pull request Nov 7, 2026
fix: treat a non-finite score as missing in DocumentJoiner DBSF mode #13582
Merged
@LuckVd LuckVd mentioned this pull request Nov 11, 2026
[Bug]: DocumentJoiner propagates NaN scores in concatenate/merge modes and the final score sorting #13678
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@sjrl sjrl sjrl approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@sjrl sjrl

Labels

topic:tests type:documentation Improvements on the docs

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@simin-yuan @CLAassistant @sjrl
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.
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.