aboutsummaryrefslogtreecommitdiffstats
path: root/background_scripts/completion.coffee
diff options
context:
space:
mode:
authorStephen Blott2015-05-08 09:03:56 +0100
committerStephen Blott2015-05-08 09:03:56 +0100
commit2dfcd17ea485484cedf636a94b9c89c527e2e0b7 (patch)
tree9e768056ffa70a79ca8ff9c2d1d5177755ed0652 /background_scripts/completion.coffee
parent898c21808c709a1a551fa15bb82f6a3bb4810aae (diff)
downloadvimium-2dfcd17ea485484cedf636a94b9c89c527e2e0b7.tar.bz2
Search completion; add front end cache.
Diffstat (limited to 'background_scripts/completion.coffee')
-rw-r--r--background_scripts/completion.coffee15
1 files changed, 10 insertions, 5 deletions
diff --git a/background_scripts/completion.coffee b/background_scripts/completion.coffee
index 746e662d..f17ca28c 100644
--- a/background_scripts/completion.coffee
+++ b/background_scripts/completion.coffee
@@ -491,22 +491,27 @@ class MultiCompleter
# (ie. a SearchEngineCompleter). This prevents hiding the vomnibar briefly before showing it
# again, which looks ugly.
unless shouldRunContinuation and suggestions.length == 0
- onComplete @prepareSuggestions queryTerms, suggestions
+ onComplete
+ results: @prepareSuggestions queryTerms, suggestions
+ callerMayCacheResults: not shouldRunContinuation
# Allow subsequent queries to begin.
@filterInProgress = false
if shouldRunContinuation
continuation suggestions, (newSuggestions) =>
if 0 < newSuggestions.length
- onComplete @prepareSuggestions queryTerms, suggestions.concat newSuggestions
+ suggestions.push newSuggestions...
+ onComplete
+ results: @prepareSuggestions queryTerms, suggestions
+ callerMayCacheResults: true
else
@filter @mostRecentQuery.queryTerms, @mostRecentQuery.onComplete if @mostRecentQuery
prepareSuggestions: (queryTerms, suggestions) ->
suggestion.computeRelevancy queryTerms for suggestion in suggestions
suggestions.sort (a, b) -> b.relevancy - a.relevancy
- suggestions = suggestions[0...@maxResults]
- suggestion.generateHtml() for suggestion in suggestions
- suggestions
+ for suggestion in suggestions[0...@maxResults]
+ suggestion.generateHtml()
+ suggestion
# Utilities which help us compute a relevancy score for a given item.
RankingUtils =