Fix error in recursiveCollections mode with huge number of subcollections

This commit is contained in:
Dan Stillman 2017-01-27 12:00:28 -05:00
parent e6d7ae8e2f
commit 27974791b0

View file

@ -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 {