Skip to main content
Adding filters to text search is as simple as using PostgreSQL’s built-in WHERE clauses and operators. For instance, the following query filters out results that do not meet rating > 2.

Filter Pushdown

Non-Text Fields

While not required, filtering performance over non-text columns can be improved by including them in the BM25 index. When these columns are part of the index, WHERE clauses that reference them can be pushed down into the index scan itself. This can result in faster query execution over large datasets. For example, if rating and created_at are frequently used in filters, they can be added to the BM25 index during index creation:
Filter pushdown is currently supported for the following combinations of types and operators:

Text Fields

Suppose we have a text filter that looks for an exact string match like category = 'Footwear':
To push down the category = 'Footwear' filter, category must be indexed using the literal tokenizer:
Pushdown of set filters over text fields also requires the literal tokenizer: