code: function queryFunction(query) {
      var term = query.term;
      var offset = query.offset || 0;
      var results = cities.filter(function(city) {
          return transformText(city).indexOf(transformText(term)) > -1;
      });
      results.sort(function(a, b) {
          a = transformText(a);
          b = transformText(b);
          var startA = (a.slice(0, term.length) === term),
              startB = (b.slice(0, term.length) === term);
          if (startA) {
              return (startB ? (a > b ? 1 : -1) : -1);
          } else {
              return (startB ? 1 : (a > b ? 1 : -1));
          }
      });
      setTimeout(query.callback({
          more: results.length > offset + 10,
          results: results.slice(offset, offset + 10)
      }), 500);
  }
docs: example query function that returns at most 10 cities matching the given text