The model translates intent into two search channels

A request can contain both a topic and exact constraints. Self-querying retrieval separates them: descriptive language becomes the vector or text query, while explicit constraints become fields in a filter expression.

The pattern became common in retrieval frameworks as LLMs made natural-language parsing flexible, but the host must restrict the filter grammar and validate field names, operators, and values.

“EU incidents after July” should not be one embedding

For that request, “incidents” belongs in semantic retrieval, while region equals EU and date after July belong in structured filters. Embedding the entire sentence leaves exact constraints to vector geometry, which is not designed to enforce them.

Metadata filtering written directly by application code is preferable when the UI already supplies exact fields. Tool calling may carry the generated search request, but self-querying retrieval describes the translation step.

Schema quality sets the ceiling

The hybrid search guide explains how semantic and lexical retrieval can be combined after filtering. Self-querying does not apply when metadata is incomplete or access control is being delegated to model output.

The common misuse is treating a generated filter as authorization rather than as untrusted input to a policy-enforcing search layer.

The allowed query language should be smaller than the database language

The model usually needs a restricted set of fields and operators, not arbitrary SQL or a vendor’s full filter syntax. A typed intermediate representation lets the host reject unknown fields and compile allowed expressions safely.

Ambiguous dates, units, and names need an explicit policy. The system can ask for clarification rather than silently translating “recent” or “enterprise” into a filter that looks precise but was never specified.

Continue with these glossary entries: