           # previous queries with no suggestions suppress subsequent no-hope HTTP requests as the user continues
           # to type.
           for suggestion in @mostRecentSuggestions
-            return false unless 0 <= suggestion.indexOf query
+            return false unless suggestion.includes(query)
           # Ok. Re-use the suggestion.
           true
 


    # We pause in case the user is still typing.
    Utils.setTimeout @delay, handler = @mostRecentHandler = =>
      if handler == @mostRecentHandler
        @mostRecentHandler = null

        # Elide duplicate requests. First fetch the suggestions...
        @inTransit[completionCacheKey] ?= new AsyncDataFetcher (callback) =>
          engine = new EnginePrefixWrapper searchUrl, @lookupEngine searchUrl
          url = engine.getUrl queryTerms

          @get searchUrl, url, (xhr = null) =>
            # Parsing the response may fail if we receive an unexpected or an unexpectedly-formatted response.
            # In all cases, we fall back to the catch clause, below.  Therefore, we "fail safe" in the case of
            # incorrect or out-of-date completion engines.
            try
              suggestions = engine.parse xhr
              # Make all suggestions lower case.  It looks odd when suggestions from one completion engine are
              # upper case, and those from another are lower case.
              suggestions = (suggestion.toLowerCase() for suggestion in suggestions)
              # Filter out the query itself. It's not adding anything.
              suggestions = (suggestion for suggestion in suggestions when suggestion != query)
              console.log "GET", url if @debug
            catch
              suggestions = []
              # We allow failures to be cached too, but remove them after just thirty seconds.
              Utils.setTimeout 30 * 1000, => @completionCache.set completionCacheKey, null
              console.log "fail", url if @debug

            callback suggestions
            delete @inTransit[completionCacheKey]

        # ... then use the suggestions.
        @inTransit[completionCacheKey].use (suggestions) =>
          @mostRecentSearchUrl = searchUrl
          @mostRecentQuery = query
          @mostRecentSuggestions = suggestions
          callback @completionCache.set completionCacheKey, suggestions

  # Cancel any pending (ie. blocked on @delay) queries.  Does not cancel in-flight queries.  This is called
  # whenever the user is typing.

      queryTerms = [ terms.split(" ")..., queryTerms... ]
      prefix = "#{terms} "

      @postprocessSuggestions = (suggestions) ->
        suggestions.filter((s) => s.startsWith(prefix)).map((s) => s[prefix.length..])

    @engine.getUrl queryTerms

