A student asked why their RAG bot kept citing a 2022 policy document when a 2025 update existed. Both were in the index, both matched semantically, and vector search had no idea one was stale.
Filter before you search, not after
Store metadata at ingestion — document date, source, section type, access level — and apply it as a pre-filter in the vector query, not as a post-hoc check on the results. Every major vector store supports this natively.
- Date: filter to the latest version of a document family, or let the user pick a range.
- Source: separate official docs from forum answers so one never silently outranks the other.
- Section type: a table of contents chunk should not compete with body-text chunks for the same query.
The failure mode this prevents
Without filtering, semantic similarity is the only signal, and a well-written old answer beats a plainly-written current one. Metadata filtering fixes this before reranking ever runs, which is also cheaper — fewer candidates to rerank.
Pairs well with hybrid retrieval: dense, BM25 and RRF once the candidate set is already clean.
— Pranjul Rathour, GenAI Engineer from Kanpur, India. Open to GenAI roles, hackathon judging, mentorship sessions and guest talks at any campus: pranjulrathour41@gmail.com.
