Self-Querying and Metadata-Aware Retrieval
In this article
- Turn the conditions in a customer's question into typed filters a model fills from a fixed schema, and keep the rest as text for search.
- Check each proposed filter in code against the schema and the stored values, and spot the field, operator or value that must be rejected.
- Explain why the access predicate is built from the signed-in identity, added last, and out of the model's reach.
- Handle a filter that finds nothing, a dropped negation and a date read in the wrong timezone.
- Terms defined here: self-querying, entity extraction.
Overview
A customer writes: "Since April 2026, how long do home customers have to return a router? Not business plans." Half of that sentence is conditions: a date, a kind of customer, a plan type to leave out. A search that matches by meaning treats them as more text, so a page about business plans can still rank first, because it talks about returns too.
Brightline (a made-up home-internet provider) searches its help pages and router manuals in short passages called chunks, and its support assistant puts the best 3 into each request. Here a step that reads the customer's question runs before that search. A model turns the conditions into typed filters, each a field with a fixed kind of value; code checks every value; then code adds the customer's access rule, where no model output can change it.
Sign in to keep reading
The rest of this article opens with an account. An account also keeps your progress and quiz results on every device, and lets you follow news for up to five topics.
Still to read in this article
- Words that are filters
- The schema the model fills
- Code checks every value
- The access predicate comes last
- Four cases, run
- When a filter finds nothing
- Negation and dates
- Common mistakes
- In production
- Sources
- Check yourself, 13 questions