Phrase matching searches for a specified sequence of terms, usually preserving their order and adjacency. In search content, characters form sequences, sequences form terms, and sequential terms form phrases such as “software engineer” or “senior software engineer.” section 2.2
The distinction from broader term-sequence matching is important: “chief executive officer” is sequential, while “chief officer” with a positional allowance is not necessarily adjacent. Search systems may also treat single terms as phrases for convenience. section 2.2
Phrase features in ranking
A learning-to-rank model can use phrase matching as a relevance signal alongside fuzzy matching. For example, name_bigram performs a two-word phrase search on the name field, while short_description_bigram performs the same operation on short_description. Training and evaluation then test whether these features improve ranking on search sessions. section 12.2.1
Listing 12.3 A new model improved by changing the features
feature_set = [
ltr.generate_fuzzy_query_feature(feature_name="name_fuzzy",
field_name="name"),
ltr.generate_bigram_query_feature(feature_name="name_bigram",
field_name="name"),
ltr.generate_bigram_query_feature(feature_name="short_description_bigram"
field_name="short_description")]
evaluation = train_and_evaluate_model(sessions, "ltr_model_variant_2",
feature_set)
display(evaluation)
Inspect the feature-set listing to see phrase matching represented as configurable bigram query features in a ranking pipeline. section 12.2.1
Phrase matching also supports semantic search pipelines: phrases can be learned from documents or user signals, extracted from incoming queries, and used when rewriting queries to interpret intent. section 6.6
