How to Filter Vector Search by Metadata So Results Stay in Scope
Index the metadata fields you filter on, apply the filter before ranking, and check no other tenant results leak through.
THE FIELD GUIDE
Understand model formats, context windows, quantization, embeddings, and sampling before choosing settings for a real task.
Index the metadata fields you filter on, apply the filter before ranking, and check no other tenant results leak through.
Use cosine for direction, dot product for magnitude-aware ranking, and Euclidean only when the scale of the vectors matters.
Pick HNSW for fast recall on a changing collection, and IVF when build cost and memory matter more than top recall.
Match the vector database to your collection size, your filtering needs and where you can run it, before you ingest anything.
Use MRR when the first right answer matters, and nDCG when several right answers should rank in order.
Check the answer against the question, not against the chunks, and flag answers that are true but beside the point.
Score the retrieved chunks in rank order, and check the relevant ones sit above the irrelevant ones.
Compare every claim in a RAG answer with the retrieved chunks, and flag any claim the chunks do not support.
Build a labelled test set, run the retriever, and count how many of the right chunks it found and how many wrong…
Remove the server from the client, revoke its OAuth tokens, and check it can no longer reach your data.