diff options
| author | Stephen Blott | 2015-05-28 10:32:46 +0100 |
|---|---|---|
| committer | Stephen Blott | 2015-05-28 10:34:54 +0100 |
| commit | a975ce087c4beac442e5cfaeb7fb0510e54c82a4 (patch) | |
| tree | b08ac945fcb33a2b0b9166e3f7e9b28d0427f5ff /background_scripts/completion.coffee | |
| parent | 4b4fb7957e89adddcf454c56e902f2c3395eadbc (diff) | |
| download | vimium-a975ce087c4beac442e5cfaeb7fb0510e54c82a4.tar.bz2 | |
Custom-only: remove now unnecessary optimisation.
This optimisation is now unnecessary, because we will *always* show at
least one completion suggestion in top spot.
Diffstat (limited to 'background_scripts/completion.coffee')
| -rw-r--r-- | background_scripts/completion.coffee | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/background_scripts/completion.coffee b/background_scripts/completion.coffee index 8f8754f8..d8b946a1 100644 --- a/background_scripts/completion.coffee +++ b/background_scripts/completion.coffee @@ -10,7 +10,7 @@ # - refresh(): (optional) refreshes the completer's data source (e.g. refetches the list of bookmarks). # - cancel(): (optional) cancels any pending, cancelable action. class Suggestion - showRelevancy: true # Set this to true to render relevancy when debugging the ranking scores. + showRelevancy: false # Set this to true to render relevancy when debugging the ranking scores. constructor: (@options) -> # Required options. @@ -539,20 +539,7 @@ class SearchEngineCompleter # continuation. onComplete suggestions, filter: filter - continuation: (suggestions, onComplete) => - - # We can skip querying the completion engine if any new suggestions we propose will not score highly - # enough to make the list anyway. We construct a suggestion which perfectly matches the query, and - # ask the relevancy function what score it would get. If that score is less than the score of the - # lowest-ranked suggestion from another completer (and there are already 10 suggestions), then - # there's no need to query the completion engine. - perfectRelevancyScore = @computeRelevancy new Suggestion - queryTerms: queryTerms, title: queryTerms.join " " - - if 10 <= suggestions.length and perfectRelevancyScore < suggestions[suggestions.length-1].relevancy - console.log "skip (cannot make the grade):", suggestions.length, query if SearchEngineCompleter.debug - return onComplete [] - + continuation: (onComplete) => CompletionSearch.complete searchUrl, queryTerms, (suggestions = []) => console.log "fetched suggestions:", suggestions.length, query if SearchEngineCompleter.debug onComplete suggestions.map mkSuggestion @@ -632,7 +619,7 @@ class MultiCompleter if shouldRunContinuations jobs = new JobRunner continuations.map (continuation) -> (callback) -> - continuation suggestions, (newSuggestions) -> + continuation (newSuggestions) -> suggestions.push newSuggestions... callback() |
