Skip to content

Commit

Permalink
after loaded, there'll be no filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
arunoda committed Dec 26, 2014
1 parent 520ffb4 commit ce61733
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions lib/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ SearchSource.prototype._loadData = function(query, options) {
var version = 0;
if(this._canUseHistory(query)) {
this._updateStore(this.history[query].data);
self._storeDep.changed();
} else {
this.status.set({loading: true});
version = ++this._currentVersion;
Expand Down Expand Up @@ -50,6 +51,8 @@ SearchSource.prototype._loadData = function(query, options) {
if(version == self._currentVersion) {
self.status.set({loaded: true});
}

self._storeDep.changed();
}
}
};
Expand Down Expand Up @@ -77,8 +80,6 @@ SearchSource.prototype._updateStore = function(data) {
removedItem.forEach(function(id) {
self.store.remove(id);
});

self._storeDep.changed();
};

SearchSource.prototype.search = function(query, options) {
Expand All @@ -98,12 +99,15 @@ SearchSource.prototype.getData = function(options) {
var self = this;
this._storeDep.depend();
var selector = {};
self.searchFields.forEach(function(field) {
selector[field] = new RegExp(self.currentQuery, 'i');
});

var regExp = new RegExp(self.currentQuery, "i");

// only do client side searching if we are on the loading state
// once loaded, we need to send all of them
if(this.getStatus().loading) {
self.searchFields.forEach(function(field) {
selector[field] = new RegExp(self.currentQuery, 'i');
});
}

function transform(doc) {
self.searchFields.forEach(function(field) {
if(self.currentQuery && doc[field]) {
Expand Down

0 comments on commit ce61733

Please sign in to comment.