// Generated by CoffeeScript 2.3.2
(function() {
  module.exports = function(settings) {
    return function({query, type}) {
      var ref, view;
      view = (ref = settings.types[type].views) != null ? ref[query._view] : void 0;
      return function(rsp) {
        var compose, empty, encode, map, reduce, ref1;
        ({map, reduce, empty, encode, compose} = (ref1 = view.init(settings)) != null ? ref1 : view);
        return encode(compose({
          hits: rsp.hits.hits
        }.map(map).reduce(reduce, empty())));
      };
    };
  };

}).call(this);
