liveBook · Manning

Query enrichment

As explained in AI-Powered Search

Query enrichment is the process of adding semantic information, related terms, classifications, or representations to a query before retrieval.

Query enrichment adds semantic information to a parsed query before retrieval. In a semantic search pipeline, parsing extracts entities and relationships, enrichment interprets them, transformation rewrites the query for recall and ranking, and searching executes it. section 7.4

Enrichment can attach relevance learned from user interactions, topic classifications, related terms, synonyms, misspellings, signal boosts, personalization data, or embedding vectors. The useful combination depends on the search domain rather than on one universal recipe. section 7.4.2

A practical implementation separates enrichment into two complementary mechanisms:

  • Semantic functions apply dynamic rules to query-tree nodes, such as interpreting “popular” as a popularity boost or “near” as a geographic filter. section 7.4.2
  • A semantic knowledge graph supplies related terms and classifications for unknown keywords, then stores those enrichments on the corresponding entity. section 7.4.2
  • Canonical-form mappings and additional entity fields let the same pipeline add alternate representations, boosts, classifications, related terms, or vectors. section 7.4.2
Semantic Function Entities
+-------+-------------------+----------+----------------------------------+
|surface|canonical_form     |popularity|semantic_function                 |
+-------+-------------------+----------+----------------------------------+
|near   |{location_distance}|90        |location_distance(query, position)|
|in     |{location_distance}|100       |location_distance(query, position)|
|by     |{location_distance}|90        |location_distance(query, position)|
|by     |{text_within_on...}|10        |text_within_one_edit_distance(...)|
|near   |{text_distance}    |10        |text_distance(query, position)    |
|popular|{popular}          |100       |popularity(query, position)       |
|top    |{popular}          |100       |popularity(query, position)       |
|best   |{popular}          |100       |popularity(query, position)       |
|good   |{popular}          |100       |popularity(query, position)       |
+-------+-------------------+----------+----------------------------------+

Use the semantic-function table to inspect how surface forms map to canonical functions, including location, popularity, and text-distance interpretations. section 7.4.2

Turning query language into search constraints

A query containing “popular” can be rewritten into a Solr function that boosts documents using star ratings. A query containing “near” or “by” can consume the following city entity and replace both terms with a geographic filter around that city. The query tree is processed node by node; unsuccessful semantic functions become invalid rather than silently changing the query. section 7.4.2

A second path enriches keyword nodes through a semantic knowledge graph, retrieving related terms and document categories before marking the node as enriched. This keeps enrichment extensible: new models can add fields without replacing the parsing framework. section 7.4.2

How AI-Powered Search covers it

How deep it goes
Explains pipeline phases, query-tree processing, semantic functions, and knowledge-graph enrichment, while leaving combinations domain-specific.
Examples
Uses popularity boosts, geographic filters, related terms, document categories, canonical forms, and query-tree nodes.
What it assumes
Assumes parsed query entities and relationships, while building enrichment from query trees and entity fields.
What you can do after
Implement query-tree enrichment with semantic functions and semantic-knowledge-graph lookups.
How it connects
Connects query parsing, semantic search, knowledge graphs, synonyms, personalization, signal boosting, and dense vector search.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of AI-Powered Search. The section links point to the parts of the book it draws on.