diff options
Diffstat (limited to 'background_scripts/completion.coffee')
| -rw-r--r-- | background_scripts/completion.coffee | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/background_scripts/completion.coffee b/background_scripts/completion.coffee index 1f0a0019..22740128 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. @@ -281,7 +281,7 @@ class DomainCompleter queryTerms: queryTerms type: "domain" url: domains[0]?[0] ? "" # This is the URL or an empty string, but not null. - relevancy: 1 + relevancy: 2 ].filter (s) -> 0 < s.url.length # Returns a list of domains of the form: [ [domain, relevancy], ... ] @@ -477,22 +477,28 @@ class SearchEngineCompleter type: description url: Utils.createSearchUrl queryTerms, searchUrl title: queryTerms.join " " - relevancy: 1 + relevancy: 2 autoSelect: custom forceAutoSelect: custom highlightTerms: not haveCompletionEngine - mkSuggestion = (suggestion) => - new Suggestion - queryTerms: queryTerms - type: description - url: Utils.createSearchUrl suggestion, searchUrl - title: suggestion - insertText: suggestion - highlightTerms: false - isCustomSearch: custom - relevancyFunction: @computeRelevancy - relevancyData: factor + mkSuggestion = do => + count = 0 + (suggestion) => + console.log count + new Suggestion + queryTerms: queryTerms + type: description + url: Utils.createSearchUrl suggestion, searchUrl + title: suggestion + insertText: suggestion + highlightTerms: false + isCustomSearch: custom + # The first (top) suggestion gets a score of 1. This puts it two <Tab>s away if a domain completion + # is present (which has a score of 2), and one <Tab> away otherwise. + relevancy: if 0 < count++ then null else 1 + relevancyFunction: @computeRelevancy + relevancyData: factor cachedSuggestions = if haveCompletionEngine then CompletionSearch.complete searchUrl, queryTerms else null |
