fastrag.ingestion.filters.base#

Filter: the composable predicate base every concrete filter builds on.

A filter is a small predicate over a Source or Document that composes with &, | and ~ instead of being written as one growing conditional, e.g. html_filter & agrospai_filter.

Classes

Filter()

Base abstract class for composable entity filtering.

class fastrag.ingestion.filters.base.Filter[source]#

Bases: ABC, Generic[T_contra]

Base abstract class for composable entity filtering.

property header_safe: bool#

Whether matching uses identity/metadata only, never content/vectors.

Custom filters default to full records. Override only for predicates that remain correct on the index-only cache projection.

abstractmethod matches(item)[source]#

Evaluate whether an entity passes the filter criteria.

Parameters:

item (T_contra) – Item to evaluate (e.g. a Source or Document).

Returns:

True if the item satisfies the condition, False otherwise.

Return type:

bool