From 3c7d3d2af5e2d9ab42a1959bd53a06485c0d24dd Mon Sep 17 00:00:00 2001 From: Aaron Boodman Date: Sat, 4 Jan 2014 18:34:51 -0800 Subject: [PATCH] Change describe depth in web ui for search queries from 3 to 2. As far as I know, the code never uses the third level. This reduces a particularly bad example of https://code.google.com/p/camlistore/issues/detail?id=319 from returning 1.8MB of data to a svelte 1.2MB. Change-Id: Ibfe4ca3f1b175cd316f6f603950991c1a2fc8577 --- server/camlistored/ui/search_session.js | 26 +++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/server/camlistored/ui/search_session.js b/server/camlistored/ui/search_session.js index 11682a748..3d57edbc4 100644 --- a/server/camlistored/ui/search_session.js +++ b/server/camlistored/ui/search_session.js @@ -59,12 +59,20 @@ SearchSession.SEARCH_SESSION_CHANGE_TYPE = { UPDATE: 3 }; -// This size doesn't matter, we don't use it. We only care about the aspect ratio. -// TODO(aa): Change describe to just return aspect directly. -SearchSession.prototype.THUMBNAIL_SIZE_ = 1000; - SearchSession.prototype.PAGE_SIZE_ = 50; +SearchSession.DESCRIBE_REQUEST = { + // This size doesn't matter, we don't use it. We only care about the aspect ratio. + // TODO(aa): Change describe to just return aspect directly. + thumbnailSize: 1000, + + // TODO(aa): This is not great. The describe request will still return tons of data we don't care about: + // - Children of folders + // - Properties we don't use + // See: https://code.google.com/p/camlistore/issues/detail?id=319 + depth: 2 +}; + SearchSession.instanceCount_ = 0; SearchSession.prototype.getQuery = function() { @@ -119,10 +127,7 @@ SearchSession.prototype.initSocketUri_ = function(currentUri) { }; SearchSession.prototype.getContinuation_ = function(changeType, opt_continuationToken) { - var describe = { - thumbnailSize: this.THUMBNAIL_SIZE_ - }; - return this.connection_.search.bind(this.connection_, this.query_, describe, this.PAGE_SIZE_, opt_continuationToken, + return this.connection_.search.bind(this.connection_, this.query_, this.constructor.DESCRIBE_REQUEST, this.PAGE_SIZE_, opt_continuationToken, this.searchDone_.bind(this, changeType)); }; @@ -158,10 +163,7 @@ SearchSession.prototype.startSocketQuery_ = function() { this.socket_.close(); } - var describe = { - thumbnailSize: this.THUMBNAIL_SIZE_ - }; - var query = this.connection_.buildQuery(this.query_, describe, this.data_.blobs.length); + var query = this.connection_.buildQuery(this.query_, this.constructor.DESCRIBE_REQUEST, this.data_.blobs.length); this.socket_ = new WebSocket(this.socketUri_.toString()); this.socket_.onopen = function() {