From b04a90e85ffb65d53429c0d482bff98c9a80151e Mon Sep 17 00:00:00 2001 From: Phil Crosby Date: Sun, 3 Jun 2012 01:19:02 -0700 Subject: Show relevancy in the ui for debugging search ranking --- background_scripts/completion.coffee | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'background_scripts') diff --git a/background_scripts/completion.coffee b/background_scripts/completion.coffee index 2f6053b8..47ab1ac4 100644 --- a/background_scripts/completion.coffee +++ b/background_scripts/completion.coffee @@ -1,14 +1,21 @@ class Suggestion + showRelevancy: true # Set this to true to render relevancy when debugging the ranking scores. + # - type: one of [bookmark, history, tab]. constructor: (@queryTerms, @type, @url, @title, @computeRelevancyFunction, @extraRelevancyData) -> generateHtml: -> - @html ||= + return @html if @html + relevancyHtml = if @showRelevancy then "#{@computeRelevancy() + ''}" else "" + @html = "
#{@type} #{@highlightTerms(utils.escapeHtml(@title))}
-
#{@shortenUrl(@highlightTerms(@url))}
" +
+ #{@shortenUrl(@highlightTerms(@url))} + #{relevancyHtml} +
" shortenUrl: (url) -> @stripTrailingSlash(url).replace(/^http:\/\//, "") @@ -177,4 +184,4 @@ root = exports ? window root.Suggestion = Suggestion root.BookmarkCompleter = BookmarkCompleter root.MultiCompleter = MultiCompleter -root.HistoryCompleter = HistoryCompleter \ No newline at end of file +root.HistoryCompleter = HistoryCompleter -- cgit v1.2.3