From b425d1804912ceb654e3b0070d9f2a2eb65a751e Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Fri, 15 May 2015 07:57:46 +0100 Subject: Give the vomnibar a (kind of) history (relevancy). --- background_scripts/completion.coffee | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'background_scripts') 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 -- cgit v1.2.3