Metadata filters, and the difference between filtering and ranking
In short
A metadata filter is a binary admissibility rule: a passage either satisfies it and may compete for a place in the results, or it does not and cannot be returned at all. A boost is continuous, moving a passage up or down a list it is already in. Filters produce empty result sets; boosts produce buried ones. Anything driven by entitlement has to be a filter.
Key takeaways
- A filter changes who is allowed to compete. A boost changes who wins. They fail in opposite directions.
- Entitlement, tenancy and legal scope are filters. Recency and source preference are boosts.
- Every filter you might want has to exist as a field at index time. Retrofitting one means a reindex.
- A filter matching a tiny slice of the corpus is not a filter, it is a different query.
A metadata filter is a rule over the structured fields stored with each chunk — source, date, department, document type, tenant, permission key — deciding which passages may be returned at all. It is binary: a passage that fails it is not ranked low, it is not in the running.
That is the whole distinction from a boost, and worth being pedantic about: the 2 are described with the same words in most documentation and fail in opposite directions. A filter set too tight returns nothing. A boost set too weak returns everything, in a slightly better order.
Admissibility is binary, preference is continuous
| Property | Hard filter | Score boost |
|---|---|---|
| What it acts on | Membership of the candidate set | Position within a set already chosen |
| Effect of getting it wrong | Nothing comes back, or something that should not have | The right passage comes back in the wrong place |
| Right for | Entitlement, tenancy, jurisdiction, effective dates | Recency, source authority, format preference |
| Auditability | A predicate you can state, test and show a reviewer | A weight whose effect depends on every other score in the list |
The last row settles most arguments. A filter is a statement someone can read: this query considered only documents this user may open. A boost is a number whose behaviour shifts with every list, so it underwrites nothing.
The fields worth carrying on every chunk
Filters can only use fields that exist at query time, so what to store is decided at ingest, long before anyone knows which filter they need. Retrofitting one means a reindex.
- Tenant and permission key. The 2 fields that must never be a boost, and worth testing on every release.
- Source system and native record id. Lets you exclude a whole connector after a bad import, and a citation resolve to something a person can open.
- Document type and status. Draft, superseded, approved, template — the most useful filter in most corpora, and usually the last one added.
- Effective and expiry dates, distinct from the ingest date. A policy live from April and replaced in September needs both, and neither is the day it was indexed.
- Content hash and pipeline run id. Operational rather than user-facing, and the difference between isolating a bad batch and rebuilding all of it.
Filtering before the search and after it are different algorithms
Post-filtering runs the search first and discards candidates that fail the rule. It is trivial on any store, and it silently shrinks the result set: the search had no idea the filter existed when it chose those candidates.
Pre-filtering restricts the space before or during the search, so every candidate is admissible. It needs index support, and the cost lands on the engine: against a very selective condition an approximate index may widen its search or fall back to scanning, so latency becomes a function of how much of the corpus the filter admits. That data-dependent tail is what an objective must be written against, not an average — the distinction in SLA versus SLO for an AI feature.
Between them sits over-fetching: ask for more candidates than you need, then post-filter, accepting that the multiplier is a guess. It holds while filters are loose and breaks when someone adds a narrow one — recall collapsing the day permission filtering was turned on.
A boost demotes a passage the user may not see. A filter means it was never a candidate. Only one is a permission model.
Why a filter mistake is quieter than a ranking one
A bad ranking is visible: the answer is weaker, someone complains, you look at the order. A bad filter destroys the evidence of its own mistake. The passage that would have answered is absent rather than low, and the model composes something confident from what survived.
- An overly tight condition returns 2 passages instead of 10, so the answer reads thin rather than wrong.
- A filter value derived from the question can be extracted wrongly — last year becoming the wrong date range — a failure of query rewriting before retrieval, not of the filter.
- An exact-match predicate over free text is brittle in the way lexical and semantic retrieval fail differently describes: Legal and legal-department differ.
- A filter applied to only one arm of a hybrid search leaks through the other, which is how permission bugs survive code review.
Because filters decide which evidence is admissible, they decide what an answer can be supported by. An assistant that filtered out the governing document and answered anyway produced something confident and unsupported — groundedness as a property of an answer. Log the filter set beside the query, as part of that answer's provenance.
Choosing which metadata to capture is a schema decision taken in the first version, when it is cheap, rather than after the first reindex, when it is not — which is why we treat retrieval metadata as product design in MVP and product builds. Where the permission check sits is adding permission filters to retrieval. Neighbouring terms are in retrieval and grounding, part of the engineering library.
Frequently asked questions
Short answers to the follow-ups this page tends to raise.
What is metadata filtering in vector search?
It is a rule over the structured fields stored with each chunk, deciding which passages may be returned at all. Unlike a similarity score it is binary: a chunk failing the rule is excluded from the candidate set rather than ranked lower. Typical fields are tenant, permission key, document type and effective date.
What is the difference between pre-filtering and post-filtering?
Pre-filtering restricts the searchable space before or during the search, so every candidate is admissible. Post-filtering searches first and discards afterwards, so a selective filter can leave a handful of results or none. It is easier to build and quietly reduces recall.
Should permissions be a filter or a ranking signal?
Always a filter, applied inside the search rather than after it. A ranking signal only demotes a passage, leaving it in the candidate set where a weight change or a debug flag can promote it back. Entitlement is a question about admissibility, so it belongs where admissibility is decided.
Why does adding a filter sometimes return no results at all?
Because it is applied after the candidates were chosen and admits too small a share of them. If a condition matches 1 chunk in 1,000 and you retrieve 100 candidates first, most queries return nothing. Push selective conditions into the search.
- metadata
- filtering
- vector search
- definitions
The work behind this page
Builds from our portfolio that this page draws on.
AskVault
An AI internal knowledge-search platform that answers employee questions from your own docs — grounded in citations, with knowledge gaps surfaced and deflection tracked.
Productivity AINotewell
An AI meeting assistant that records and transcribes every meeting, extracts the decisions and action items, assigns owners and due dates, and tracks follow-through until it's done.
Productivity AIRead next
- Recall collapsed the day you turned on permission filteringThe retrieval quality did not change. A filter applied after the nearest-neighbour search is eating a candidate set that was already fixed at k, and the users with least access feel it first.diagnostic
- What a reranking stage does to a candidate listA reranker rescores a list that already exists. It reads the query and each passage together, which a stored vector cannot — and it can only ever reorder what the first stage found.definition
- Groundedness: what separates a supported answer from a plausible oneGroundedness relates a claim to the evidence supplied with it. Correctness relates it to the world. Systems lose credibility in the gap between the two.definition
- Adding one new source made unrelated answers worseNothing about the old passages changed. A new source ranks moderately well on a great many queries, and a fixed top-k has to give it those slots by taking them from something else.diagnostic
- Chunk overlap: what it protects against and what it duplicatesOverlap is insurance against a chunk boundary landing in the middle of one idea. The premium is paid in duplicated candidates crowding a fixed number of prompt slots.definition
- Facts in the middle of a long context get missedHold the passage set constant, walk the answer-bearing chunk from first position to last, and measure. The shape of the resulting curve is the diagnosis, and it takes about an hour to produce.diagnostic
Working on something in this space?
Tell us where you are in a sentence or two. We'll tell you honestly whether we're the right team, and what a sensible first slice of the work looks like.
Start the conversation