|
|
@ -22,15 +22,11 @@ package eu.faircode.email;
|
|
|
|
import android.annotation.SuppressLint;
|
|
|
|
import android.annotation.SuppressLint;
|
|
|
|
import android.content.ContentValues;
|
|
|
|
import android.content.ContentValues;
|
|
|
|
import android.content.Context;
|
|
|
|
import android.content.Context;
|
|
|
|
import android.content.SharedPreferences;
|
|
|
|
|
|
|
|
import android.database.Cursor;
|
|
|
|
import android.database.Cursor;
|
|
|
|
import android.database.sqlite.SQLiteDatabase;
|
|
|
|
import android.database.sqlite.SQLiteDatabase;
|
|
|
|
import android.database.sqlite.SQLiteException;
|
|
|
|
|
|
|
|
import android.database.sqlite.SQLiteOpenHelper;
|
|
|
|
import android.database.sqlite.SQLiteOpenHelper;
|
|
|
|
import android.text.TextUtils;
|
|
|
|
import android.text.TextUtils;
|
|
|
|
|
|
|
|
|
|
|
|
import androidx.preference.PreferenceManager;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.io.File;
|
|
|
|
import java.io.File;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.Arrays;
|
|
|
|
import java.util.Arrays;
|
|
|
@ -69,13 +65,6 @@ public class Fts4DbHelper extends SQLiteOpenHelper {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void onCreate(SQLiteDatabase db) {
|
|
|
|
public void onCreate(SQLiteDatabase db) {
|
|
|
|
Log.i("FTS create");
|
|
|
|
Log.i("FTS create");
|
|
|
|
|
|
|
|
|
|
|
|
// https://www.sqlite.org/fts3.html#tokenizer
|
|
|
|
|
|
|
|
// https://unicode.org/reports/tr29/
|
|
|
|
|
|
|
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
|
|
|
|
|
|
|
boolean unicode61 = prefs.getBoolean("unicode61", BuildConfig.DEBUG);
|
|
|
|
|
|
|
|
String tokenizer = (unicode61 ? "tokenize=unicode61 \"remove_diacritics=0\"" : null);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
db.execSQL("CREATE VIRTUAL TABLE `message`" +
|
|
|
|
db.execSQL("CREATE VIRTUAL TABLE `message`" +
|
|
|
|
" USING fts4" +
|
|
|
|
" USING fts4" +
|
|
|
|
" (`account`" +
|
|
|
|
" (`account`" +
|
|
|
@ -88,8 +77,9 @@ public class Fts4DbHelper extends SQLiteOpenHelper {
|
|
|
|
", `notes`" +
|
|
|
|
", `notes`" +
|
|
|
|
", notindexed=`account`" +
|
|
|
|
", notindexed=`account`" +
|
|
|
|
", notindexed=`folder`" +
|
|
|
|
", notindexed=`folder`" +
|
|
|
|
", notindexed=`time`" +
|
|
|
|
", notindexed=`time`)");
|
|
|
|
(tokenizer == null ? "" : ", " + tokenizer) + ")");
|
|
|
|
// https://www.sqlite.org/fts3.html#tokenizer
|
|
|
|
|
|
|
|
// https://unicode.org/reports/tr29/
|
|
|
|
|
|
|
|
|
|
|
|
// https://www.sqlite.org/fts3.html#fts4aux
|
|
|
|
// https://www.sqlite.org/fts3.html#fts4aux
|
|
|
|
db.execSQL("CREATE VIRTUAL TABLE message_terms USING fts4aux('message');");
|
|
|
|
db.execSQL("CREATE VIRTUAL TABLE message_terms USING fts4aux('message');");
|
|
|
|