You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bug 1960786 - Dismiss AMP suggestions by full keyword instead of URL
This adds `SuggestStore::dismiss`, which takes a `Suggestion`, and deprecates
`SuggestStore::dismiss_suggestion`, which takes a URL.
It also makes one other substantive change: If an AMP suggestion doesn't have
`full_keywords` defined in its RS data, then `Suggestion.full_keyword` will now
be an empty string instead of a string computed at query time from its keywords.
The problem with using such a computed "full keyword" as the dismissal key is
that it's not stable. It's just the prefix of one of the suggestion's keywords
up to the next full word after the query string, so it changes the more you
type.
When the RS data doesn't have a `full_keywords`, I set `Suggestion.full_keyword`
to an empty string and then fall back to the suggestion's URL as the dismissal
key. In practice, all AMP suggestions have full keywords in the RS data (I
checked), and going forward with the new AMP API that won't change, so we
shouldn't ever hit this to begin with.
Other possible ways to address this:
* Change the query-time full keyword calculation so that the longest matching
keyword is used as the full keyword. That might actually be good for UX too,
maybe not in all cases.
* Add a `Suggestion` member called `is_full_keyword_from_db` or something (like
the similarly named variable in the AMP fetch function), and then we'd use the
URL as the dismissal key if `is_full_keyword_from_db` is false.
These are both more complex than setting `full_keywords` to an empty string and
using that to tell if the dismissal key should be the URL, and since we
shouldn't ever hit this anyway, I didn't bother.
0 commit comments