diff options
| author | Stephen Blott | 2015-05-11 14:37:57 +0100 |
|---|---|---|
| committer | Stephen Blott | 2015-05-11 14:43:29 +0100 |
| commit | 3975c13fe040639beb56582e50d951ad4839afbb (patch) | |
| tree | 9e6086f5d416c142837868178d55955bd34ca0c2 /background_scripts | |
| parent | 212a47dca607983f424a59da3b5ab915f3aff403 (diff) | |
| download | vimium-3975c13fe040639beb56582e50d951ad4839afbb.tar.bz2 | |
Search completion; add weigthing option.
Diffstat (limited to 'background_scripts')
| -rw-r--r-- | background_scripts/completion.coffee | 6 | ||||
| -rw-r--r-- | background_scripts/settings.coffee | 1 |
2 files changed, 5 insertions, 2 deletions
diff --git a/background_scripts/completion.coffee b/background_scripts/completion.coffee index 25fdf44e..23526f85 100644 --- a/background_scripts/completion.coffee +++ b/background_scripts/completion.coffee @@ -416,7 +416,9 @@ class SearchEngineCompleter return onComplete [] unless custom or 0 < queryTerms.length query = queryTerms.join " " + factor = Settings.get "omniSearchWeight" haveCompletionEngine = CompletionSearch.haveCompletionEngine searchUrl + haveCompletionEngine = false unless 0.0 < factor # Relevancy: # - Relevancy does not depend upon the actual suggestion (so, it does not depend upon word @@ -429,7 +431,7 @@ class SearchEngineCompleter # a useful suggestion from another completer. # characterCount = query.length - queryTerms.length + 1 - relavancy = 0.6 * (Math.min(characterCount, 10.0)/10.0) + relavancy = 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 @@ -478,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? + if cachedSuggestions? and 0 < factor console.log "cached suggestions:", cachedSuggestions.length, query if SearchEngineCompleter.debug suggestions.push cachedSuggestions.map(mkSuggestion)... return onComplete suggestions, { filter, continuation: null } diff --git a/background_scripts/settings.coffee b/background_scripts/settings.coffee index 11f492d7..e042eded 100644 --- a/background_scripts/settings.coffee +++ b/background_scripts/settings.coffee @@ -43,6 +43,7 @@ root.Settings = Settings = # or strings defaults: scrollStepSize: 60 + omniSearchWeight: 0.6 smoothScroll: true keyMappings: "# Insert your preferred key mappings here." linkHintCharacters: "sadfjklewcmpgh" |
