Sub topic 5
Query fan-out: one question, many searches
This chapter assumes you know how a traditional search engine ranks pages and what a search query is. It also assumes you have used an AI chat or AI search product. You don't need to program. The short code sketches are there to make the ideas concrete.
What query fan-out is
Query fan-out is when an AI search system takes one user prompt and turns it into several narrower searches. It runs those searches, then combines what comes back into one answer.
In classic search, one query produces one ranked list. In a fan-out system, the prompt is closer to a task description than to a search string. The system works out what the user needs to know, breaks that into parts, and searches for each part.
Some vendors have described this behaviour publicly. Google has described a "query fan-out" technique in its AI search features. Other products show visible search steps while they work. The details differ between products, and most of the internals are not public. Treat everything below as a working model. It is not a specification of any one system.
Why systems fan out
A single search string rarely covers a rich question. Take the prompt "best running shoes for flat feet". A good answer needs several things:
- What flat feet mean for shoe choice.
- Which shoe types suit them.
- Which specific models are well reviewed.
- Which of those fit the user's budget or foot width.
- What a medical or expert source says.
One keyword search would favour pages that happen to match the whole phrase. Splitting the task lets the system retrieve evidence for each need separately. It also lets the system find a page that is strong on one part and weak on another.
An illustrative expansion
The example below is hand-written. It is not output from any real system. It shows the kind of spread you might expect from one prompt.
{
"user_prompt": "best running shoes for flat feet",
"illustrative_sub_queries": [
"running shoes for flat feet",
"stability vs motion control shoes overpronation",
"running shoe arch support types",
"best running shoes flat feet wide fit",
"running shoes for flat feet under 100 dollars",
"podiatrist advice running shoes flat feet"
]
}Notice four patterns in these sub-queries:
- The first is close to the original prompt.
- Some use different vocabulary ("overpronation", "arch support") that the user never typed.
- Some add constraints a user might care about (price, width).
- One looks for an expert angle.
The next chapter covers these types in more detail. Here the point is that the pages that answer the prompt may differ from the pages that rank for the prompt itself.
The fan-out flow
The steps are:
- Understand the prompt. The system infers intent and may use conversation history.
- Generate sub-queries. Usually a language model does this, which is why the output varies.
- Retrieve for each sub-query. Each search returns its own ranked list of passages or pages.
- Merge. The lists are combined into one candidate set.
- Rerank. A more careful model reorders the candidates.
- Synthesise. A language model writes the answer from the selected passages and may cite them.
Later chapters cover steps 4 to 6. This chapter focuses on steps 1 to 3 and on what fan-out changes for you.
Why fan-out changes who gets seen
Merging is where fan-out matters most. A page can appear in the lists for several sub-queries without topping any of them. Reciprocal rank fusion is a published method for merging ranked lists, and it shows the effect. Real systems may use different methods, so read this as a demonstration of the principle.
def reciprocal_rank_fusion(rankings, k=60):
"""Merge several ranked lists of document IDs into one list."""
scores = {}
for ranking in rankings:
for rank, doc in enumerate(ranking, start=1):
scores[doc] = scores.get(doc, 0) + 1 / (k + rank)
return sorted(scores, key=scores.get, reverse=True)
results_per_sub_query = [
["page_a", "page_b", "page_c"],
["page_b", "page_d", "page_a"],
["page_e", "page_b"],
]
print(reciprocal_rank_fusion(results_per_sub_query))Each appearance adds a score of 1 / (k + rank). Here page_b appears in all three lists, in positions 2, 1 and 2. It beats page_a, which is first in one list and third in another, and it beats page_e, which is first in one list only. The program prints ['page_b', 'page_a', 'page_e', 'page_d', 'page_c'].
The lesson for content is that breadth across related sub-questions can matter as much as winning one query. Another lesson is that fusion alone does not decide the final answer. A reranker and the writing step still choose which passages are used.
Edge cases and common errors
Treating the sub-queries as a fixed list
Sub-queries are generated, not looked up. Run the same prompt twice and you may see different expansions. The number of sub-queries can also change with the prompt's complexity and with the product's settings. Plan for a range of likely sub-questions, not an exact set.
Assuming the head term is what matters
Many sub-queries will be longer, more specific, or phrased unlike anything in your keyword research. Your page may be retrieved because it answers "stability vs motion control shoes" and not because it ranks for "best running shoes".
Assuming a top classic ranking guarantees inclusion
Classic ranking and AI retrieval overlap but are not the same. Some products draw on a conventional search index. Others use their own index or other sources. Whether a page that ranks well in classic search is also retrieved for sub-queries depends on the product, and outsiders cannot confirm the rules.
Treating fan-out as universal
Not every prompt triggers it. Simple factual questions may be answered with one search, or with no search at all if the model answers from memory. Products also differ in whether a user can switch search on or off.
Mixing up what you see and what happens
Some interfaces show the searches they ran. Those displays may be summaries and may not list every query. Use them as evidence, but not as a complete log.
What this means in practice
You cannot see the fan-out for your target prompts in advance. You can reason about it:
- List the sub-questions a thoughtful researcher would ask about your topic.
- Check which of them your page answers clearly, in a passage that stands on its own.
- Watch the visible search steps in products that show them, and record what you see.
The coverage audit chapter turns this into a procedure. The measurement chapter explains how to track results given the variability described above.
Summary of the working model
| Aspect | Classic search | Fan-out AI search |
|---|---|---|
| Input | One query string | A prompt, often longer and conversational |
| Retrieval | One ranked list | Several lists, one per sub-query |
| Unit of competition | Page for a query | Passage across several sub-queries |
| Output | List of links | A written answer, often with citations |
| Repeatability | Fairly stable | Varies between runs |
Exercise
A page ranks third in one sub-query list and appears in the lists for two other sub-queries, at positions 2 and 4. A competitor page is first in one list and absent from the others. Using reciprocal rank fusion with k=60, which page scores higher, and what does that show?
Show answer
The first page scores 1/63 + 1/62 + 1/64 ≈ 0.01587 + 0.01613 + 0.01563 = 0.04763. The competitor scores 1/61 ≈ 0.01639. The first page wins by a wide margin. This shows that appearing across several related sub-queries can outweigh a single top rank, at least under this merging method. Real systems may merge differently, and reranking can change the final order.
Exercise
You run the same prompt in an AI search product on two days. The visible searches differ. Give two reasons this can happen and one way to plan for it.
Show answer
Sub-queries are usually generated by a language model, so the output can vary between runs. The product's index, settings or model may also have changed. To plan for it, prepare for a range of likely sub-questions about the topic instead of one fixed list, and repeat observations several times when you record them.