diff options
Diffstat (limited to 'background_scripts')
| -rw-r--r-- | background_scripts/completion.coffee | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/background_scripts/completion.coffee b/background_scripts/completion.coffee index eb80f3cd..80b47055 100644 --- a/background_scripts/completion.coffee +++ b/background_scripts/completion.coffee @@ -225,7 +225,7 @@ class BookmarkCompleter RankingUtils.wordRelevancy(suggestion.queryTerms, suggestion.url, suggestion.title) class HistoryCompleter - filter: ({ queryTerms }, onComplete) -> + filter: ({ queryTerms, tabToOpen }, onComplete) -> @currentSearch = { queryTerms: @queryTerms, onComplete: @onComplete } results = [] HistoryCache.use (history) => @@ -233,6 +233,9 @@ class HistoryCompleter results = if queryTerms.length > 0 history.filter (entry) -> RankingUtils.matches(queryTerms, entry.url, entry.title) + else if tabToOpen + # <Tab> opens the completion list, even without a query. + history else [] onComplete results.map (entry) => @@ -256,6 +259,8 @@ class HistoryCompleter computeRelevancy: (suggestion) -> historyEntry = suggestion.relevancyData recencyScore = RankingUtils.recencyScore(historyEntry.lastVisitTime) + # If there are no query terms, then relevancy is based on recency alone. + return recencyScore if suggestion.queryTerms.length == 0 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 |
