Pre-filtering is a strategy for combining metadata conditions with vector search by applying the filter first, identifying the set of vectors that satisfy the conditions, and then running similarity search only within that qualifying set. The filter narrows the field before the vector search begins.
Its advantage shows when filters are highly selective. If a condition reduces billions of vectors to a few thousand, searching only those is far faster than searching everything and is guaranteed to consider exactly the right candidates. Pre-filtering ensures no qualifying vector is overlooked simply because it fell outside an approximate search’s path.
The challenge is that graph-based indexes like HNSW are built over the whole dataset, and restricting the search to an arbitrary subset can break the graph’s navigability, hurting recall — the recall cliff. A naive pre-filter may also be slow if computing the qualifying set is expensive. Modern databases address this with filter-aware indexing and in-graph techniques that get the benefits of pre-filtering while preserving recall, making it a strong choice for selective and high-cardinality filters.