aboutsummaryrefslogtreecommitdiffstats
path: root/background_scripts/completion.coffee
diff options
context:
space:
mode:
authorStephen Blott2015-05-11 15:17:41 +0100
committerStephen Blott2015-05-11 15:17:41 +0100
commit7f0736ee48c80e33ec8d7ef52e1a713501281f72 (patch)
tree03196fc6aa387efb30effb32b6740b34087e4351 /background_scripts/completion.coffee
parent104dc7ff2c88c7df9760c6ca35991d9c160bbb35 (diff)
downloadvimium-7f0736ee48c80e33ec8d7ef52e1a713501281f72.tar.bz2
Search completion; fix relevancy calculation.
Diffstat (limited to 'background_scripts/completion.coffee')
-rw-r--r--background_scripts/completion.coffee10
1 files changed, 5 insertions, 5 deletions
diff --git a/background_scripts/completion.coffee b/background_scripts/completion.coffee
index 23526f85..e38a4e16 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.
@@ -418,7 +418,7 @@ class SearchEngineCompleter
query = queryTerms.join " "
factor = Settings.get "omniSearchWeight"
haveCompletionEngine = CompletionSearch.haveCompletionEngine searchUrl
- haveCompletionEngine = false unless 0.0 < factor
+ haveCompletionEngine = false if factor == 0.0 and not custom
# Relevancy:
# - Relevancy does not depend upon the actual suggestion (so, it does not depend upon word
@@ -431,7 +431,7 @@ class SearchEngineCompleter
# a useful suggestion from another completer.
#
characterCount = query.length - queryTerms.length + 1
- relavancy = factor * (Math.min(characterCount, 10.0)/10.0)
+ relevancy = (if custom then 0.9 else factor) * (Math.min(characterCount, 10.0)/10.0)
# This distinguishes two very different kinds of vomnibar baviours, the newer bahviour (true) and the
# legacy behavior (false). We retain the latter for the default search engine, and for custom search
@@ -467,7 +467,7 @@ class SearchEngineCompleter
type: description
url: Utils.createSearchUrl suggestion, searchUrl
title: suggestion
- relevancy: relavancy *= 0.9
+ relevancy: relevancy *= 0.9
insertText: suggestion
highlightTerms: false
selectCommonMatches: true
@@ -480,7 +480,7 @@ class SearchEngineCompleter
# Post suggestions and bail if we already have all of the suggestions, or if there is no prospect of
# adding further suggestions.
if queryTerms.length == 0 or cachedSuggestions? or not haveCompletionEngine
- if cachedSuggestions? and 0 < factor
+ if haveCompletionEngine and cachedSuggestions?
console.log "cached suggestions:", cachedSuggestions.length, query if SearchEngineCompleter.debug
suggestions.push cachedSuggestions.map(mkSuggestion)...
return onComplete suggestions, { filter, continuation: null }