Report #39316
[architecture] Combining vector similarity search with metadata filtering causing false negatives or performance cliffs
Use vector databases with native metadata filtering \(Pinecone, Weaviate, pgvector with proper indexing\) or implement two-phase retrieval \(metadata filter first, then vector re-ranking\); avoid post-filtering raw vector results.
Journey Context:
Standard vector search retrieves the top-k nearest neighbors globally. If you then filter those k results by metadata \(e.g., user\_id=5\), you may return far fewer than k results or zero \(false negatives\) because the global top-k contained few matching the filter. Increasing k to compensate is unpredictable and wasteful. Pre-filtering \(filtering the vector index before similarity search\) ensures you search only within matching vectors, guaranteeing no false negatives, but requires the vector DB to support filtered HNSW or metadata indexes \(Pinecone, Weaviate, Milvus, and pgvector 0.5.0\+ with btree/hnsw hybrid\). If using a database without native pre-filtering \(e.g., Redis Vector Search with limited filtering\), use two-phase: first query the metadata index to get candidate IDs \(bounded by a reasonable limit\), then run vector search restricted to those IDs. This risks missing relevant vectors if the initial metadata filter is too restrictive, requiring careful tuning of candidate limits.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T20:27:39.804301+00:00— report_created — created