diff --git a/chrome/content/zotero/xpcom/collectionTreeView.js b/chrome/content/zotero/xpcom/collectionTreeView.js index 23c37508f..448f99a34 100644 --- a/chrome/content/zotero/xpcom/collectionTreeView.js +++ b/chrome/content/zotero/xpcom/collectionTreeView.js @@ -893,8 +893,11 @@ Zotero.ItemGroup.prototype.getSearchObject = function() { // Create/load the inner search var s = new Zotero.Search(); - if (this.isLibrary()) { } + if (this.isLibrary()) { + s.addCondition('noChildren', 'true'); + } else if (this.isCollection()) { + s.addCondition('noChildren', 'true'); s.addCondition('collectionID', 'is', this.ref.getID()); if (Zotero.Prefs.get('recursiveCollections')) { s.addCondition('recursive', 'true'); diff --git a/chrome/content/zotero/xpcom/itemTreeView.js b/chrome/content/zotero/xpcom/itemTreeView.js index c1b062e39..8e0c59d89 100644 --- a/chrome/content/zotero/xpcom/itemTreeView.js +++ b/chrome/content/zotero/xpcom/itemTreeView.js @@ -188,6 +188,8 @@ Zotero.ItemTreeView.prototype.refresh = function() cacheFields = cacheFields.concat(field); } } + + Zotero.DB.beginTransaction(); Zotero.Items.cacheFields(cacheFields); var newRows = this._itemGroup.getChildItems(); @@ -221,6 +223,8 @@ Zotero.ItemTreeView.prototype.refresh = function() } } + Zotero.DB.commitTransaction(); + this._refreshHashMap(); // Update the treebox's row count diff --git a/chrome/content/zotero/xpcom/notifier.js b/chrome/content/zotero/xpcom/notifier.js index f03e16ace..7c9c6b10e 100644 --- a/chrome/content/zotero/xpcom/notifier.js +++ b/chrome/content/zotero/xpcom/notifier.js @@ -249,6 +249,8 @@ Zotero.Notifier = new function(){ } } + reset(); + if (totals) { Zotero.debug("Committing Notifier event queue" + totals); @@ -261,7 +263,6 @@ Zotero.Notifier = new function(){ } } } - reset(); } diff --git a/chrome/content/zotero/xpcom/search.js b/chrome/content/zotero/xpcom/search.js index 9f485cdef..b69d98307 100644 --- a/chrome/content/zotero/xpcom/search.js +++ b/chrome/content/zotero/xpcom/search.js @@ -341,10 +341,13 @@ Zotero.Search.prototype.search = function(asTempTable){ } if (this._scope) { + Zotero.DB.beginTransaction(); + // If subsearch has post-search filter, run and insert ids into temp table if (this._scope.hasPostSearchFilter()) { var ids = this._scope.search(); if (!ids) { + Zotero.DB.commitTransaction(); return false; } @@ -375,6 +378,7 @@ Zotero.Search.prototype.search = function(asTempTable){ var ids = Zotero.DB.columnQuery(sql, this._sqlParams); Zotero.DB.query("DROP TABLE " + tmpTable); + Zotero.DB.commitTransaction(); } else { var ids = Zotero.DB.columnQuery(this._sql, this._sqlParams); @@ -528,6 +532,8 @@ Zotero.Search.prototype.getSQLParams = function(){ Zotero.Search.prototype._idsToTempTable = function (ids) { var tmpTable = "tmpSearchResults_" + Zotero.randomString(8); + Zotero.DB.beginTransaction(); + var sql = "CREATE TEMPORARY TABLE " + tmpTable + " (itemID INT)"; Zotero.DB.query(sql); var sql = "INSERT INTO " + tmpTable + " VALUES (?)"; @@ -546,6 +552,8 @@ Zotero.Search.prototype._idsToTempTable = function (ids) { var sql = "CREATE INDEX " + tmpTable + "_itemID ON " + tmpTable + "(itemID)"; Zotero.DB.query(sql); + Zotero.DB.commitTransaction(); + return tmpTable; }