From 4ec5e46ece2cd12d5ebb8db6a8ebcb8690687a1f Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Mon, 18 May 2015 08:23:16 +0100 Subject: Search completion; retain previous suggestions (comments and tweaks). --- background_scripts/completion.coffee | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/background_scripts/completion.coffee b/background_scripts/completion.coffee index 8768a39f..e6e8deaf 100644 --- a/background_scripts/completion.coffee +++ b/background_scripts/completion.coffee @@ -480,9 +480,14 @@ class SearchEngineCompleter # And the URL suffix (which must contain the query part) matches the current query. RankingUtils.matches queryTerms, suggestion.url[engine.searchUrlPrefix.length..]) + # 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 + # text, without regard to whether the completion engine can complete the actual text of the query. previousSuggestions = for url, suggestion of @previousSuggestions continue unless RankingUtils.matches queryTerms, suggestion.title + # Reset the previous relevancy and HTML, they may not be correct wrt. the current query. + extend suggestion, relevancy: null, html: null suggestion.relevancy = null suggestion -- cgit v1.2.3