[#162,be/elasticsearch][s]: convert elasticsearch to the new setup (remove all Backbone from the Backend!).

* Also convert to new QueryResult format in which no _source, _type etc - cf #159
This commit is contained in:
Rufus Pollock
2012-06-23 22:29:51 +01:00
parent dd45991321
commit 31980857a9
4 changed files with 132 additions and 112 deletions

View File

@@ -79,7 +79,11 @@ my.Dataset = Backbone.Model.extend({
var dfd = $.Deferred();
// TODO: fail case;
if (this.backend !== recline.Backend.Memory) {
this.backend.fetch(this.toJSON()).then(handleResults)
this.backend.fetch(this.toJSON())
.done(handleResults)
.fail(function(arguments) {
dfd.reject(arguments);
});
} else {
// special case where we have been given data directly
handleResults({
@@ -100,14 +104,15 @@ my.Dataset = Backbone.Model.extend({
self.fields.reset(results.fields);
}
// TODO: parsing the processing of fields
dfd.resolve(this);
dfd.resolve(self);
}
return dfd.promise();
},
save: function() {
var self = this;
return this._store.save(this._changes, this);
// TODO: need to reset the changes ...
return this._store.save(this._changes, this.toJSON());
},
// ### query