mirror of
https://github.com/M66B/FairEmail.git
synced 2026-03-28 20:06:29 +01:00
Small improvements
This commit is contained in:
@@ -72,23 +72,29 @@ public class WorkerFts extends Worker {
|
||||
Log.i("FTS index=" + id);
|
||||
|
||||
EntityMessage message = db.message().getMessage(id);
|
||||
if (message == null)
|
||||
throw new FileNotFoundException("Message gone");
|
||||
if (message == null) {
|
||||
Log.i("FTS gone");
|
||||
continue;
|
||||
}
|
||||
|
||||
File file = message.getFile(context);
|
||||
String text = HtmlHelper.getFullText(file);
|
||||
if (TextUtils.isEmpty(text))
|
||||
throw new FileNotFoundException("Message empty");
|
||||
if (TextUtils.isEmpty(text)) {
|
||||
Log.i("FTS empty");
|
||||
continue;
|
||||
}
|
||||
|
||||
boolean fts = prefs.getBoolean("fts", false);
|
||||
if (fts)
|
||||
try {
|
||||
sdb.beginTransaction();
|
||||
FtsDbHelper.insert(sdb, message, text);
|
||||
sdb.setTransactionSuccessful();
|
||||
} finally {
|
||||
sdb.endTransaction();
|
||||
}
|
||||
if (!fts)
|
||||
break;
|
||||
|
||||
try {
|
||||
sdb.beginTransaction();
|
||||
FtsDbHelper.insert(sdb, message, text);
|
||||
sdb.setTransactionSuccessful();
|
||||
} finally {
|
||||
sdb.endTransaction();
|
||||
}
|
||||
|
||||
indexed++;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user