Does filtering based on property effectively scope vector search?

Hi, I’m curious whether the vector search with filtering on property means vector search among only those objects meeting filtering condition. This question occurred to me when I read Pinecone doc saying

“Searches with metadata filters retrieve exactly the number of nearest-neighbor results that match the filters.” (Filtering with metadata)

This actually boils down to whether I could scope vector search within objects matching the filtering condition. Let’s say we have a class “book”, and one of its property is subcategory like “novel” or “non-fiction”. In case I’d like to perform vector search only WITHIN novels, the filtering should be done BEFORE vector search. So, how Weaviate is doing?

Hi, I’m curious whether the vector search with filtering on property means vector search among only those objects meeting filtering condition.

Yes that is correct. Please see these docs for the approach Filtering (with search) | Weaviate - vector database. Weaviate uses pre-filtering but in edge cases where the filter is very restrictive it will also skip the hnsw index and use brute force instead.

1 Like