Sub topic 11
Merging the Results of Many Searches
Assume you know how traditional search ranking works and have used an AI search product. This chapter focuses on what happens after query fan-out creates several searches. The system must merge their result lists before it can choose evidence for an answer.
Why one page can win several searches
Each sub-query produces a ranked list of documents or passages. The lists may overlap, but their order can differ.
For example, a system might search for:
- Running shoes for flat feet
- Stability versus motion-control shoes
- Wide-fit running shoes
- Running shoes under 100 dollars
- Podiatrist advice about flat feet
A page that appears near the top for several searches may cover the user's overall need better than a page that ranks first for only one narrow search.
A simple merging method is reciprocal rank fusion, or RRF. It gives each result a score based on its rank in each list:
def reciprocal_rank_fusion(rankings, k=60):
"""Merge several ranked lists of document IDs into one list."""
scores = {}
for ranking in rankings:
for rank, document in enumerate(ranking, start=1):
scores[document] = scores.get(document, 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))The result is likely to put page_b first because it appears near the top in all three lists. The parameter k reduces the difference between adjacent ranks. In real systems, the merging method may be proprietary or may combine many signals besides rank.
From documents to passages
Search systems often retrieve passages rather than entire pages. A passage is a smaller section of a document that appears relevant to a sub-query.
This matters because a page can be generally relevant while containing no useful passage for a particular question. A product guide might discuss arch support but never state which options cost less than 100 dollars. Its page-level topic match will not replace missing evidence.
A typical flow looks like this:
Reranking the merged candidates
Fusion creates a candidate set. It does not necessarily choose the final evidence. A reranker examines those candidates again, often with a more expensive relevance model.
It may consider:
- How directly a passage answers the sub-question
- Whether the passage is understandable without missing context
- Whether several passages repeat the same claim
- The source's quality, freshness, and authority
- Whether the passage supports a specific statement rather than merely sharing keywords
A passage can therefore rise or fall after fusion. Ranking is also often query-dependent. A source that is useful for product definitions may be less useful for current prices.
What marketers should do
Plan content around related questions, not only one target phrase. Give each important question a clear section with a direct answer and enough surrounding context to stand alone as a passage.
Check whether your page covers:
- Definitions and comparisons
- Constraints such as price, location, or audience
- Practical recommendations
- Evidence, dates, and source details
- Expert or first-hand qualifications
This approach improves the chance that different passages can satisfy different sub-queries. It does not guarantee inclusion. Retrieval, fusion, reranking, freshness, personalization, and the user's exact wording can all change the result.
Exercise
Why might a page that ranks second for three sub-queries beat a page that ranks first for only one?
Show answer
The first page has repeated evidence of relevance across the user's related needs. A fusion method can reward that consistency over a single high rank.