Filters

Pass filters to the retrievers to narrow down the retrieval results.

Basic Information

  • Pipeline type: Query
  • Type: Not applicable
  • Components it can connect with:
    • Retrievers can receive filters to narrow down the list of documents retrieved.
  • Filter Syntax

Inputs

Filters is a placeholder filled in with real values at search time, if filters are specified. Filters must be passed as a dictionary or a list of values.

Outputs

NameTypeDescription
filtersDictionaryThe filters to narrow down retrieval.

Overview

Filters represents the actual filters provided at search time. You can filter using your documents' metadata. For example, to retieve only documents with metadata type: article, pass Filters along with the query to the Rankers in your query pipeline.

Usage Example

In Builder, connect Filters to the filters inputs of the Retrievers in your query pipeline:

The Filters component connected to Embedding Retriever and BM25Retriever's `filters` inputs

In YAML, add filters to your pipeline inputs and list the components that should receive them:

inputs:
  filters:
  - "bm25_retriever.filters"
  - "embedding_retriever.filters"

Init Parameters

This component doesn't take any initialization parameters.