         suggestion
       onComplete(suggestions)
 
-  computeRelevancy: (queryTerms, suggestion) ->
-    RankingUtils.wordRelevancy(queryTerms, suggestion.url, suggestion.title)
-
+  computeRelevancy: (suggestion) ->
+    RankingUtils.wordRelevancy(suggestion.queryTerms, suggestion.url, suggestion.title)
+
+# A completer which calls filter() on many completers, aggregates the results, ranks them, and returns the top
+# 10. Queries from the vomnibar frontend script come through a multi completer.
 class MultiCompleter
-  constructor: (@completers) ->
-    @maxResults = 10 # TODO(philc): Should this be configurable?
+  constructor: (@completers) -> @maxResults = 10
 
   refresh: -> completer.refresh() for completer in @completers when completer.refresh
 
   filter: (queryTerms, onComplete) ->
-    # Only allow one query to run at a time.
+    # Allow only one query to run at a time.
     if @filterInProgress
       @mostRecentQuery = { queryTerms: queryTerms, onComplete: onComplete }
       return

          @filter(@mostRecentQuery.queryTerms, @mostRecentQuery.onComplete) if @mostRecentQuery

  sortSuggestions: (suggestions) ->
    for suggestion in suggestions
      suggestion.computeRelevancy(@queryTerms)
    suggestions.sort (a, b) -> b.relevancy - a.relevancy
    suggestions

RankingUtils =
  # Whether the given URL or title match any one of the query terms. This is used to prune out irrelevant
  # suggestions before we try to rank them.

        previous = range
    mergedRanges


class BookmarkCompleter
  currentSearch: null
