Ignore errors from individual files when rebuilding index

This commit is contained in:
Dan Stillman 2012-02-13 20:09:10 -05:00
parent 5a8d669ecc
commit 43ff47be5b

View file

@ -502,7 +502,7 @@ Zotero.Fulltext = new function(){
}
function indexItems(items, complete) {
function indexItems(items, complete, ignoreErrors) {
if (items.constructor.name != 'Array') {
items = [items];
}
@ -522,7 +522,19 @@ Zotero.Fulltext = new function(){
continue;
}
this.indexFile(file, i.attachmentMIMEType, i.attachmentCharset, i.id, !complete);
if (ignoreErrors) {
try {
this.indexFile(file, i.attachmentMIMEType, i.attachmentCharset, i.id, !complete);
}
catch (e) {
Zotero.debug(e, 1);
Components.utils.reportError("Error indexing " + file.path);
Components.utils.reportError(e);
}
}
else {
this.indexFile(file, i.attachmentMIMEType, i.attachmentCharset, i.id, !complete);
}
}
Zotero.DB.commitTransaction();
@ -902,7 +914,7 @@ Zotero.Fulltext = new function(){
if (items) {
Zotero.DB.query("DELETE FROM fulltextItemWords WHERE itemID IN (" + sql + ")");
Zotero.DB.query("DELETE FROM fulltextItems WHERE itemID IN (" + sql + ")");
this.indexItems(items);
this.indexItems(items, false, true);
}
Zotero.DB.commitTransaction();
}