Skip to content

feat: add support for multi filter retriever#11028

Merged
bogdankostic merged 14 commits intodeepset-ai:mainfrom
srini047:comp-multi-filter-retreiver
Apr 13, 2026
Merged

feat: add support for multi filter retriever#11028
bogdankostic merged 14 commits intodeepset-ai:mainfrom
srini047:comp-multi-filter-retreiver

Conversation

@srini047
Copy link
Copy Markdown
Contributor

@srini047 srini047 commented Apr 2, 2026

Related Issues

Proposed Changes:

Add support for MultiFilterRetriever, a new retriever component that executes multiple filter queries against a document store in parallel and returns a single, de-duplicated list of documents sorted by relevance score.

How did you test it?

Added unit tests around the new filter and ensured older doesn't break.

Notes for the reviewer

Checklist

  • I have read the contributors guidelines and the code of conduct.
  • I have updated the related issue with new insights and changes.
  • I have added unit tests and updated the docstrings.
  • I've used one of the conventional commit types for my PR title: fix:, feat:, build:, chore:, ci:, docs:, style:, refactor:, perf:, test: and added ! in case the PR includes breaking changes.
  • 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.

@srini047 srini047 requested a review from a team as a code owner April 2, 2026 12:40
@srini047 srini047 requested review from bogdankostic and removed request for a team April 2, 2026 12:40
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 2, 2026

@srini047 is attempting to deploy a commit to the deepset Team on Vercel.

A member of the Team first needs to authorize it.

@srini047 srini047 changed the title Comp multi filter retreiver feat: add support for multi filter retriever Apr 2, 2026
@github-actions github-actions bot added topic:tests type:documentation Improvements on the docs labels Apr 2, 2026
@bogdankostic bogdankostic self-assigned this Apr 7, 2026
Copy link
Copy Markdown
Contributor

@bogdankostic bogdankostic left a comment

Choose a reason for hiding this comment

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

Hi @srini047, thank you very much for the PR! I left a few comments on how we can simplify the MultiFilterRetriever.

@srini047 srini047 requested a review from bogdankostic April 9, 2026 09:17
@bogdankostic
Copy link
Copy Markdown
Contributor

Thanks for addressing the requested changes @srini047!

Looking at the current implementation, since FilterRetriever is the only retriever that can be used with MultiFilterRetriever, I think we should simplify the API by accepting a document_store parameter directly instead of retriever. This way, MultiFilterRetriever can create the FilterRetriever internally and users get a simpler interface.

@srini047
Copy link
Copy Markdown
Contributor Author

Thanks for addressing the requested changes @srini047!

Looking at the current implementation, since FilterRetriever is the only retriever that can be used with MultiFilterRetriever, I think we should simplify the API by accepting a document_store parameter directly instead of retriever. This way, MultiFilterRetriever can create the FilterRetriever internally and users get a simpler interface.

@bogdankostic If we look at the issue that was the ask to take filters as input: MultiFilterRetriever so a version of the FilterRetriever that can handle a list of filters as input.

WDYT?

@bogdankostic
Copy link
Copy Markdown
Contributor

bogdankostic commented Apr 13, 2026

Sorry @srini047, I think I was not communicating precisely enough. What I'm suggesting does not affect the run method, it should still take a list of filters as input. I'm only suggesting to change the __init__ to accept a document_store directly instead of a FilterRetriever instance, since MultiFilterRetriever only ever uses FilterRetriever internally.

Here's a skeleton to illustrate what I mean:

@component
class MultiFilterRetriever:
    def __init__(self, document_store: DocumentStore, max_workers: int = 3) -> None:
        self.document_store = document_store
        self.max_workers = max_workers
        self._retriever = FilterRetriever(document_store=document_store)

    @component.output_types(documents=list[Document])
    def run(self, filters: list[dict[str, Any]]) -> dict[str, list[Document]]:
        ...

This way users don't need to create a FilterRetriever themselves, they just pass the document_store and MultiFilterRetriever handles the rest internally.

@srini047
Copy link
Copy Markdown
Contributor Author

Sorry @srini047, I think I was not communicating precisely enough. What I'm suggesting does not affect the run method, it should still take a list of filters as input. I'm only suggesting to change the __init__ to accept a document_store directly instead of a FilterRetriever instance, since MultiFilterRetriever only ever uses FilterRetriever internally.

Here's a skeleton to illustrate what I mean:

@component
class MultiFilterRetriever:
    def __init__(self, document_store: DocumentStore, max_workers: int = 3) -> None:
        self.document_store = document_store
        self.max_workers = max_workers
        self._retriever = FilterRetriever(document_store=document_store)

    @component.output_types(documents=list[Document])
    def run(self, filters: list[dict[str, Any]]) -> dict[str, list[Document]]:
        ...

This way users don't need to create a FilterRetriever themselves, they just pass the document_store and MultiFilterRetriever handles the rest internally.

@bogdankostic Thanks for the clarification yes I get the crux and modified the code accordingly. This makes more sense now.

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 13, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
haystack-docs Ready Ready Preview, Comment Apr 13, 2026 11:45am

Request Review

Copy link
Copy Markdown
Contributor

@bogdankostic bogdankostic left a comment

Choose a reason for hiding this comment

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

Thank you @srini047 :)

@bogdankostic bogdankostic merged commit 61d94b7 into deepset-ai:main Apr 13, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

topic:tests type:documentation Improvements on the docs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a MultiFilterRetriever

2 participants