From 0eae69d6cb9b37fe0a41c16888f8af85197e42aa Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Wed, 27 May 2015 09:27:07 +0100 Subject: Custom-only: verify match on query terms alone. --- background_scripts/completion.coffee | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/background_scripts/completion.coffee b/background_scripts/completion.coffee index 3238f744..7dbd2e61 100644 --- a/background_scripts/completion.coffee +++ b/background_scripts/completion.coffee @@ -484,8 +484,12 @@ class SearchEngineCompleter filter = (suggestions) -> suggestions.filter (suggestion) -> # We only keep suggestions which either *were* generated by this completion engine, or *could have - # been* generated by this completion engine. - suggestion.isSearchSuggestion or suggestion.isCustomSearch or Utils.extractQuery searchUrl, suggestion.url + # been* generated by this completion engine (and match the current query). + suggestion.isSearchSuggestion or suggestion.isCustomSearch or + ( + terms = Utils.extractQuery searchUrl, suggestion.url + terms and RankingUtils.matches queryTerms, terms + ) # If a previous suggestion still matches the query, then we keep it (even if the completion engine may not # return it for the current query). This allows the user to pick suggestions by typing fragments of their -- cgit v1.2.3