Repository navigation
fix: deduplicate AutoMergingRetriever documents - #13511
Merged
davidsbatista merged 4 commits intoNov 5, 2026
Merged
davidsbatista merged 4 commits into
davidsbatista merged 4 commits into
Conversation
senthurapandi2000
requested review from
davidsbatista
and removed request for
a team
October 31, 2026 19:16
Contributor
|
@senthurapandi2000 is attempting to deploy a commit to the deepset Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||
6 tasks done
This branch was successfully deployed
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
Fixes #13505
Proposed Changes
This PR fixes an issue in
AutoMergingRetrieverwhere duplicate leaf documents are counted multiple times when evaluating parent merge thresholds, potentially causing incorrect parent document retrieval.Changes made:
_deduplicate_documentsutility to retain the highest-scoring document when duplicates are encountered.run()andrun_async().How did you test it?
Unit tests:
Result: 23 passed.
Formatting and linting:
Result: All checks passed.
Type checking:
Result: No issues found in 2 source files.
The original issue was successfully reproduced before applying the fix, and the new regression tests pass afterward.
Notes for the Reviewer
The implementation reuses Haystack's existing
_deduplicate_documentshelper to keep the change minimal and consistent with other components.The change preserves existing retrieval behavior for unique documents while preventing duplicate inputs from incorrectly affecting merge decisions.
I noticed the original issue reporter mentioned having a PR prepared. Happy to coordinate if there is overlapping work.
AI assistance disclosure: ChatGPT assisted with the implementation approach and regression-test drafting. I applied the changes, ran the tests and quality checks locally, and reviewed the Git diff.
Checklist
fix:commit type.