pub fn full_keyword(query: &str, keywords: &[impl AsRef<str>]) -> String
Expand description
Given a list of keywords for a suggestion, returns a phrase that best completes the user’s query. This function uses two heuristics to pick the best match:
- Find the first keyword in the list that has at least one more word than the query, then trim the keyword up to the end of that word.
- If there isn’t a keyword with more words, pick the keyword that forms the longest suffix of the query. This might be the query itself.