Reduce memory consumption of full-text index clear
This commit is contained in:
parent
18021d1aeb
commit
926e2f7317
1 changed files with 14 additions and 14 deletions
|
@ -1447,8 +1447,8 @@ Zotero.Fulltext = Zotero.FullText = new function(){
|
|||
*
|
||||
* @return {Promise}
|
||||
*/
|
||||
this.clearIndex = function (skipLinkedURLs) {
|
||||
return Zotero.DB.executeTransaction(function* () {
|
||||
this.clearIndex = async function (skipLinkedURLs) {
|
||||
await Zotero.DB.executeTransaction(async function () {
|
||||
var sql = "DELETE FROM fulltextItems";
|
||||
if (skipLinkedURLs) {
|
||||
var linkSQL = "SELECT itemID FROM itemAttachments WHERE linkMode ="
|
||||
|
@ -1456,23 +1456,23 @@ Zotero.Fulltext = Zotero.FullText = new function(){
|
|||
|
||||
sql += " WHERE itemID NOT IN (" + linkSQL + ")";
|
||||
}
|
||||
yield Zotero.DB.queryAsync(sql);
|
||||
await Zotero.DB.queryAsync(sql);
|
||||
|
||||
sql = "DELETE FROM fulltextItemWords";
|
||||
if (skipLinkedURLs) {
|
||||
sql += " WHERE itemID NOT IN (" + linkSQL + ")";
|
||||
}
|
||||
yield Zotero.DB.queryAsync(sql);
|
||||
await Zotero.DB.queryAsync(sql);
|
||||
});
|
||||
|
||||
if (skipLinkedURLs) {
|
||||
yield this.purgeUnusedWords();
|
||||
}
|
||||
else {
|
||||
yield Zotero.DB.queryAsync("DELETE FROM fulltextWords");
|
||||
}
|
||||
if (skipLinkedURLs) {
|
||||
await this.purgeUnusedWords();
|
||||
}
|
||||
else {
|
||||
await Zotero.DB.queryAsync("DELETE FROM fulltextWords");
|
||||
}
|
||||
|
||||
yield clearCacheFiles();
|
||||
}.bind(this));
|
||||
await clearCacheFiles();
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue