A surface form is the text a searcher actually types for an entity or meaning. In an entity lookup index, each surface form is paired with a canonical form: the representation the query parser uses after matching. Indexing several surface forms for one canonical form lets a query for “amin” resolve to “admin,” or “cto” to “chief technology officer.” section 7.4.1
To use surface forms in a search pipeline:
- Store known phrases and spelling variations as entity records with surface_form, canonical_form, type, and popularity fields. section 7.4.1
- Tag matching spans of the incoming query, then look up their entity records. Keep unmatched text as keywords rather than discarding it. section 7.4.1
- When one surface form has several meanings, retain its candidate entities and select an interpretation; the illustrated query-tree builder uses popularity for that choice. section 7.4.1
- Enrich the resulting query tree: a matched form can lead to a canonical entity, a semantic function, or additional information for an unmatched keyword. section 7.4.2
From typed words to a query tree
For “top kimchi near charlotte,” the extractor tags “top,” “near,” and “charlotte”; “kimchi” remains a keyword. The surface form “top” maps to {popular}. “Near” has both location-distance and text-distance candidates, with the location interpretation assigned higher popularity in the example. Once the query tree identifies Charlotte as a city, the location function can turn “near Charlotte” into a geographic filter instead of searching for the word “near.” section 7.4.1 section 7.4.2
[{"semantic_function": "popularity(query, position)", "popularity": 100,
"id": "7", "surface_form": "top", "type": "semantic_function",
"canonical_form": "{popular}"},
{"type": "keyword", "surface_form": "kimchi", "canonical_form": "kimchi"},
{"semantic_function":"location_distance(query, position)", "popularity":90,
"id": "1", "surface_form": "near", "type": "semantic_function",
"canonical_form": "{location_distance}"},
{"country": "US", "admin_area": "NC", "popularity": 827097,
"id": "4460243", "surface_form": "Charlotte", "type": "city",
"location_coordinates": "35.22709,-80.84313",
"canonical_form": "Charlotte"}]
Inspect the typed query tree to see matched surface forms beside their canonical forms, while the unmatched keyword retains its original text. section 7.4.1
A surface-form match is not necessarily a settled interpretation: “near” can refer to different functions, and a name can match multiple entities. Store alternatives deliberately and check whether the chosen interpretation fits the surrounding query. The mapping also provides a place to attach learned signals, related terms, classifications, or vectors without requiring users to type the canonical representation. section 7.4.1 section 7.4.2
