Skip to content

Commit

Permalink
Fix error in recursiveCollections mode with huge number of subcollect…
Browse files Browse the repository at this point in the history
…ions
  • Loading branch information
dstillman committed Jan 27, 2017
1 parent e6d7ae8 commit 2797479
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions chrome/content/zotero/xpcom/data/search.js
Expand Up @@ -1198,20 +1198,14 @@ Zotero.Search.prototype._buildQuery = Zotero.Promise.coroutine(function* () {
}

if (objectType == 'collection') {
var q = ['?'];
var p = [obj.id];
let ids = [obj.id];

// Search descendent collections if recursive search
if (recursive){
var descendents = obj.getDescendents(false, 'collection');
for (let d of descendents) {
q.push('?');
p.push(d.id);
}
ids = ids.concat(obj.getDescendents(false, 'collection').map(d => d.id));
}

condSQL += "collectionID IN (" + q.join() + ")";
condSQLParams = condSQLParams.concat(p);
condSQL += 'collectionID IN (' + ids.join(', ') + ')';
}
// Saved search
else {
Expand Down

0 comments on commit 2797479

Please sign in to comment.