liveBook · Manning

Query expansion

Also called query augmentation

Query expansion is an information-retrieval technique that adds related terms, variants, or reformulations to a query to improve retrieval.

How 4 Manning books explain it

AI-Powered Search

Query expansion is a retrieval technique that augments a query with additional terms or representations to improve matching with relevant content.

How it is used
Uses expansion to improve semantic matching and ranking when indexed documents use terms beyond a user's query.
How deep it goes
Works through graph traversal, term weighting, and request strategies, then compares graph-based expansion with model-generated sparse tokens.
Examples
Uses weighted medicine terms, a fictional-metal query, contextual senses of “server,” and SPLADE++ food queries.
What you can do after
Apply it via semantic knowledge graph traversal or SPLADE++ and configure expanded matching or ranking boosts.

Read how AI-Powered Search explains query expansion →

LLM Evaluation and Alignment, The Foundational Ideas

Query expansion is a retrieval technique that augments a search query with additional terms or related expressions to improve matching.

How it is used
Improves retrieval recall when query vocabulary differs from relevant documents, especially in BM25 or pattern-matching systems.
How deep it goes
Adds synonym terms or relaxes regex matching at the application layer, without changing the retrieval system.
Examples
Contrasts “authentication failure” with “login rejection” and adds synonym terms or relaxes regex patterns.
What you can do after
Diagnose/debug with it by identifying lexical mismatch behind low context recall and augmenting queries with synonyms or relaxed regex patterns.

Read how LLM Evaluation and Alignment, The Foundational Ideas explains query expansion →

Retrieval Augmented Generation, The Foundational Ideas

Query expansion generates alternative query terms or formulations to improve the recall of relevant information.

How it is used
Broadens RAG retrieval when one query misses relevant documents because it incompletely expresses the user’s intent.
How deep it goes
Traces query variants through parallel retrieval and rank fusion, then illustrates the flow with placeholder Python functions.
Examples
Uses student-laptop searches for durability, weight, budget and battery life, plus simulated ranked document lists.
What you can do after
Build it from scratch as a toy Python multi-query retrieval pipeline, or apply it with LlamaIndex’s fusion retriever.

Read how Retrieval Augmented Generation, The Foundational Ideas explains query expansion →

The Art of AI Product Development

A retrieval technique that adds terms, variants, or related subqueries to an original search query to improve retrieval results.

How it is used
Improves RAG retrieval when users submit vague or poorly structured questions.
How deep it goes
Explains rewriting and expansion through concrete subqueries, but stops short of implementation details.
Examples
Uses AI-trends questions, SaaS platforms, workflow automation, and classification by technical, market, or integration intent.
What you can do after
Apply query expansion to turn broad user questions into targeted retrieval subqueries.

Read how The Art of AI Product Development explains query expansion →

Also covered in

What to know first

Related concepts

Questions about query expansion

What is query expansion?

Query expansion is an information-retrieval technique that adds related terms, variants, or reformulations to a query to improve retrieval.

Which Manning books explain query expansion?

AI-Powered Search, LLM Evaluation and Alignment, The Foundational Ideas, Retrieval Augmented Generation, The Foundational Ideas and The Art of AI Product Development.

What should I know before learning query expansion?

Manning books that teach query expansion usually introduce similarity search, language model, vector database and BM25 first.

What is the difference between query expansion and planning?

Query expansion is an information-retrieval technique that adds related terms, variants, or reformulations to a query to improve retrieval. Planning is the process of determining and organizing intended actions or steps toward a goal, often accounting for conditions or constraints.

What is query expansion also called?

Query expansion is also called query augmentation.

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.