diff options
| author | Stephen Blott | 2015-05-15 07:57:46 +0100 |
|---|---|---|
| committer | Stephen Blott | 2015-05-15 07:57:46 +0100 |
| commit | b425d1804912ceb654e3b0070d9f2a2eb65a751e (patch) | |
| tree | dac7d8eaaa6dc0ba8f4bbc1ad718b0aa7fc45810 /background_scripts/completion.coffee | |
| parent | cc6c64fa5729a07be4567b2ca11bfadec6b02be2 (diff) | |
| download | vimium-b425d1804912ceb654e3b0070d9f2a2eb65a751e.tar.bz2 | |
Give the vomnibar a (kind of) history (relevancy).
Diffstat (limited to 'background_scripts/completion.coffee')
| -rw-r--r-- | background_scripts/completion.coffee | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/background_scripts/completion.coffee b/background_scripts/completion.coffee index 2ee4a666..fd0a4c51 100644 --- a/background_scripts/completion.coffee +++ b/background_scripts/completion.coffee @@ -256,6 +256,14 @@ class HistoryCompleter historyEntry = suggestion.relevancyData recencyScore = RankingUtils.recencyScore(historyEntry.lastVisitTime) wordRelevancy = RankingUtils.wordRelevancy(suggestion.queryTerms, suggestion.url, suggestion.title) + if suggestion.insertText? + # If this suggestion matches a previous search with the default search engine, then we also score the + # previous query terms themselves (suggestion.insertText) and, if that score is higher, then we use it + # in place of the wordRelevancy score. Because the query terms are shorter than the original URL, this + # has the side effect of boosting the wordRelevancy score for previous searches with the default search + # engine. + wordRelevancy = Math.max wordRelevancy, + RankingUtils.wordRelevancy suggestion.queryTerms, suggestion.insertText, suggestion.title # Average out the word score and the recency. Recency has the ability to pull the score up, but not down. (wordRelevancy + Math.max recencyScore, wordRelevancy) / 2 |
