A search for “driver” might concern a taxi or computer software. The word alone cannot settle its meaning. Context includes nearby query terms, indexed content, the domain, and what is known about the user. A search system uses these clues to interpret intent rather than treating every occurrence of a term as equivalent. section 2.5.2 section 6.1
Context can change the search pipeline. A query classification might select a document category, boost particular results, or route a user directly to a product. It can also guide query rewriting: recognize domain phrases, correct spelling, and expand an ambiguous term with related words from the intended sense. Keyword matching remains a useful fallback when the intended meaning is unclear. section 6.1 section 6.6 section 2.5.2
Classify first, then choose related terms
Given indexed documents with category and body fields, a semantic knowledge graph can traverse from a query to related categories, then from each category to related body terms. For “driver,” the travel context yields terms such as “taxi,” “car,” and “license”; the devops context yields “docker” and “compose.yml.” These are different candidate interpretations, not one unrestricted synonym list. The traversal has configurable category and keyword limits and a minimum occurrence count. section 6.2
Listing 6.2 Disambiguating query intent across different contexts
def print_query_disambigutaion(query,
context_field="category", context_limit=5,
keywords_field="body", keywords_limit=10, min_occurrences=5):
nodes_to_traverse = [{"field": keywords_field, #1
"values": [query]}, #1
{"field": context_field, #2
"min_occurrences": min_occurrences, #2
"limit": context_limit}, #2
{"field": keywords_field, #3
"min_occurrences": min_occurrences, #3
"limit": keywords_limit}] #3
traversal = skg.traverse(*nodes_to_traverse)
print_disambigutaions(query, traversal)
Python traversal shows how the query, category field, and keyword field produce context-specific related terms. section 6.2
Document context is not always user context. For the misspelling “moden,” an index-based spell-checker ranks “modes” and “model” above “modem,” even though “modem” is the likely correction in a tech-products collection. Query behavior can provide a better signal of what users intend. Context also has a narrower role in extractive question answering: it is the retrieved answer passage in which a reader model looks for an answer, not a license to generate one. section 6.5.1 section 14.2.1 section 14.5.1

















