When filtering, does the filtering occur before or after the semantic search?
Hi @t3v00yaj , welcome to our community, it’s lovely to have you with us.
In Weaviate, filtering happens before the vector search, this is called pre-filtering. Here’s how it works:
-
The inverted index is queried first to build an allow-list of eligible objects
-
The vector search then only considers candidates that are on that list
This ensures you’re only searching through objects that match your filters, making the whole process more efficient.
See more here:
Best,
Mohamed Shahin
Weaviate Support Engineer
(Ireland, UTC±00:00/+01:00)
hi @t3v00yaj !!
Welcome to our community ![]()
In Weaviate, filtering occurs both before and after semantic search, depending on the type of filter:
For property-based filters, Weaviate builds an allowList of document IDs that match the filter criteria before performing the vector search. This constrains the search space to only relevant documents.
This allowList is then passed to the vector search method.
After the vector search returns results, Weaviate applies distance and certainty thresholds.
In hybrid search, there’s a special case where BM25 results are post-filtered to remove results with vector distances above a cutoff
![]()