 
   # Simplify a suggestion's URL (by removing those parts which aren't useful for display or comparison).
   shortenUrl: () ->
-    # If we already have display URL, then use it.
-    @shortUrl ?= @displayUrl
     return @shortUrl if @shortUrl?
     # We get easier-to-read shortened URLs if we URI-decode them.
     url = (Utils.decodeURIByParts(@url) || @url).toLowerCase()

    bookmark.children.forEach((child) => @traverseBookmarksRecursive child, results, bookmark) if bookmark.children

  computeRelevancy: (suggestion) ->
    RankingUtils.wordRelevancy(suggestion.queryTerms, suggestion.displayUrl ? suggestion.url, suggestion.title)

class HistoryCompleter
  filter: ({ queryTerms, seenTabToOpenCompletionList }, onComplete) ->

        @bookmarks.filter (bookmark) =>
          suggestionTitle = if usePathAndTitle then bookmark.pathAndTitle else bookmark.title
          bookmark.hasJavascriptPrefix ?= Utils.hasJavascriptPrefix bookmark.url
          bookmark.shortUrl ?= "javascript:..." if bookmark.hasJavascriptPrefix
          suggestionUrl = bookmark.shortUrl ? bookmark.url
          RankingUtils.matches(@currentSearch.queryTerms, suggestionUrl, suggestionTitle)
      else
        []
