From cdf87b7a870303df9baee7161b15362242f65dcb Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Sun, 10 May 2015 11:48:38 +0100 Subject: Search completion; strip duplicated code. --- background_scripts/completion_engines.coffee | 18 ------------------ 1 file changed, 18 deletions(-) (limited to 'background_scripts/completion_engines.coffee') diff --git a/background_scripts/completion_engines.coffee b/background_scripts/completion_engines.coffee index 78782513..51799971 100644 --- a/background_scripts/completion_engines.coffee +++ b/background_scripts/completion_engines.coffee @@ -213,24 +213,6 @@ CompletionEngines = return null if returnResultsOnlyFromCache - if @mostRecentQuery? and @mostRecentSuggestions? - # If the user appears to be typing a continuation of the characters of the most recent query, and those - # characters are also common to all of the most recent suggestions, then we can re-use the previous - # suggestions. - reusePreviousSuggestions = do (query) => - query = queryTerms.join(" ").toLowerCase() - return false unless 0 == query.indexOf @mostRecentQuery.toLowerCase() - previousSuggestions = @mostRecentSuggestions.map (s) -> s.toLowerCase() - return false unless query.length <= Utils.longestCommonPrefix previousSuggestions - true - - if reusePreviousSuggestions - console.log "reuse previous query", @mostRecentQuery if @debug - @mostRecentQuery = queryTerms.join " " - return callback @completionCache.set completionCacheKey, @mostRecentSuggestions - - return null if returnResultsOnlyFromCache - fetchSuggestions = (engine, callback) => url = engine.getUrl queryTerms query = queryTerms.join(" ").toLowerCase() -- cgit v1.2.3