[#57,backend,model][m]: switch to having backend query methods return a QueryResult object - fixes #57.

This commit is contained in:
Rufus Pollock
2012-04-01 11:45:42 +01:00
parent e5e24f72de
commit 157d77ebb1
6 changed files with 61 additions and 17 deletions

View File

@@ -43,9 +43,10 @@ my.Dataset = Backbone.Model.extend({
var self = this;
this.queryState.set(queryObj);
var dfd = $.Deferred();
this.backend.query(this, this.queryState.toJSON()).done(function(rows) {
var docs = _.map(rows, function(row) {
var _doc = new my.Document(row);
this.backend.query(this, this.queryState.toJSON()).done(function(queryResult) {
self.docCount = queryResult.total;
var docs = _.map(queryResult.hits, function(hit) {
var _doc = new my.Document(hit._source);
_doc.backend = self.backend;
_doc.dataset = self;
return _doc;