1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2025-02-24 15:11:03 +00:00

Use cursor for FTS

This commit is contained in:
M66B 2022-02-15 10:17:38 +01:00
parent 31943042a0
commit 54aea5a254
2 changed files with 5 additions and 2 deletions

View file

@ -330,7 +330,7 @@ public interface DaoMessage {
" AND NOT fts" +
" AND folder.type <> '" + EntityFolder.OUTBOX + "'" +
" ORDER BY message.received")
List<Long> getMessageFts();
Cursor getMessageFts();
@Query("SELECT message.id, account, thread, (:find IS NULL" +
" OR (:senders AND `from` LIKE :find COLLATE NOCASE)" + // no index

View file

@ -23,6 +23,7 @@ import static android.os.Process.THREAD_PRIORITY_BACKGROUND;
import android.content.Context;
import android.content.SharedPreferences;
import android.database.Cursor;
import androidx.annotation.NonNull;
import androidx.preference.PreferenceManager;
@ -66,8 +67,10 @@ public class WorkerFts extends Worker {
SQLiteDatabase sdb = FtsDbHelper.getInstance(context);
for (long id : db.message().getMessageFts())
Cursor cursor = db.message().getMessageFts();
while (cursor != null && cursor.moveToNext())
try {
long id = cursor.getLong(0);
Log.i("FTS index=" + id);
ids.add(id);