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:
parent
31943042a0
commit
54aea5a254
2 changed files with 5 additions and 2 deletions
|
@ -330,7 +330,7 @@ public interface DaoMessage {
|
||||||
" AND NOT fts" +
|
" AND NOT fts" +
|
||||||
" AND folder.type <> '" + EntityFolder.OUTBOX + "'" +
|
" AND folder.type <> '" + EntityFolder.OUTBOX + "'" +
|
||||||
" ORDER BY message.received")
|
" ORDER BY message.received")
|
||||||
List<Long> getMessageFts();
|
Cursor getMessageFts();
|
||||||
|
|
||||||
@Query("SELECT message.id, account, thread, (:find IS NULL" +
|
@Query("SELECT message.id, account, thread, (:find IS NULL" +
|
||||||
" OR (:senders AND `from` LIKE :find COLLATE NOCASE)" + // no index
|
" OR (:senders AND `from` LIKE :find COLLATE NOCASE)" + // no index
|
||||||
|
|
|
@ -23,6 +23,7 @@ import static android.os.Process.THREAD_PRIORITY_BACKGROUND;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
|
import android.database.Cursor;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.preference.PreferenceManager;
|
import androidx.preference.PreferenceManager;
|
||||||
|
@ -66,8 +67,10 @@ public class WorkerFts extends Worker {
|
||||||
|
|
||||||
SQLiteDatabase sdb = FtsDbHelper.getInstance(context);
|
SQLiteDatabase sdb = FtsDbHelper.getInstance(context);
|
||||||
|
|
||||||
for (long id : db.message().getMessageFts())
|
Cursor cursor = db.message().getMessageFts();
|
||||||
|
while (cursor != null && cursor.moveToNext())
|
||||||
try {
|
try {
|
||||||
|
long id = cursor.getLong(0);
|
||||||
Log.i("FTS index=" + id);
|
Log.i("FTS index=" + id);
|
||||||
|
|
||||||
ids.add(id);
|
ids.add(id);
|
||||||
|
|
Loading…
Reference in a new issue