This commit is contained in:
Brad Fitzpatrick 2013-12-12 13:04:13 +04:00
commit 88f9db482b
1 changed files with 4 additions and 23 deletions

View File

@ -307,7 +307,7 @@ camlistore.BlobItemContainer.prototype.search = function(callerConstraint,
thumbnailSize: this.thumbnailSize_ thumbnailSize: this.thumbnailSize_
}, },
sort: 1, // LastModifiedDesc sort: 1, // LastModifiedDesc
limit: 30, limit: 50,
constraint : { constraint : {
logical: { logical: {
op: 'and', op: 'and',
@ -323,28 +323,9 @@ camlistore.BlobItemContainer.prototype.search = function(callerConstraint,
} }
}; };
var callback = goog.bind(this.searchDone_, this, callerConstraint, this.connection_.search(JSON.stringify(query),
!isContinuation); goog.bind(this.searchDone_, this, callerConstraint,
if (window.WebSocket) { !isContinuation));
var uri = new goog.Uri(goog.uri.utils.appendPath(
this.connection_.config_.searchRoot, 'camli/search/ws'));
uri.setDomain(location.hostname);
uri.setPort(location.port);
uri.setScheme("ws");
var ws = new WebSocket(uri.toString());
ws.onopen = function() {
var message = {
tag: 'q1',
query: query
};
ws.send(JSON.stringify(message));
};
ws.onmessage = function(e) {
callback(JSON.parse(e.data).result);
}.bind(this);
} else {
this.connection_.search(JSON.stringify(query), callback);
}
}; };
camlistore.BlobItemContainer.prototype.searchDone_ = function(constraint, camlistore.BlobItemContainer.prototype.searchDone_ = function(constraint,