mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-27 11:16:51 +02:00
Revert "Added option to enable sqlite unicode61 tokenizer"
This reverts commit 3811afe451.
This commit is contained in:
@@ -177,7 +177,6 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
||||
private SwitchCompat swAnalyze;
|
||||
private SwitchCompat swAutoVacuum;
|
||||
private SwitchCompat swSyncExtra;
|
||||
private SwitchCompat swUnicode61;
|
||||
private TextView tvSqliteCache;
|
||||
private SeekBar sbSqliteCache;
|
||||
private TextView tvChunkSize;
|
||||
@@ -383,7 +382,6 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
||||
swAnalyze = view.findViewById(R.id.swAnalyze);
|
||||
swAutoVacuum = view.findViewById(R.id.swAutoVacuum);
|
||||
swSyncExtra = view.findViewById(R.id.swSyncExtra);
|
||||
swUnicode61 = view.findViewById(R.id.swUnicode61);
|
||||
tvSqliteCache = view.findViewById(R.id.tvSqliteCache);
|
||||
sbSqliteCache = view.findViewById(R.id.sbSqliteCache);
|
||||
ibSqliteCache = view.findViewById(R.id.ibSqliteCache);
|
||||
@@ -507,7 +505,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
||||
SQLiteDatabase sdb = Fts4DbHelper.getInstance(context);
|
||||
Fts4DbHelper.delete(sdb);
|
||||
Fts4DbHelper.optimize(sdb);
|
||||
} catch (Throwable ex) {
|
||||
} catch (SQLiteDatabaseCorruptException ex) {
|
||||
Log.e(ex);
|
||||
Fts4DbHelper.delete(context);
|
||||
}
|
||||
@@ -1184,37 +1182,6 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
||||
}
|
||||
});
|
||||
|
||||
swUnicode61.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton v, boolean checked) {
|
||||
prefs.edit()
|
||||
.putBoolean("fts", false)
|
||||
.putBoolean("sqlite_unicode61", checked)
|
||||
.apply();
|
||||
WorkerFts.init(getContext(), true);
|
||||
|
||||
new SimpleTask<Void>() {
|
||||
@Override
|
||||
protected Void onExecute(Context context, Bundle args) throws Throwable {
|
||||
Fts4DbHelper.delete(context);
|
||||
Fts5DbHelper.delete(context);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onExecuted(Bundle args, Void data) {
|
||||
prefs.edit().putBoolean("fts", true).apply();
|
||||
WorkerFts.init(getContext(), true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onException(Bundle args, Throwable ex) {
|
||||
Log.unexpectedError(getParentFragmentManager(), ex);
|
||||
}
|
||||
}.execute(FragmentOptionsMisc.this, new Bundle(), "unicode61");
|
||||
}
|
||||
});
|
||||
|
||||
sbSqliteCache.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
|
||||
@Override
|
||||
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
|
||||
@@ -2083,7 +2050,6 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
||||
swAnalyze.setChecked(prefs.getBoolean("sqlite_analyze", true));
|
||||
swAutoVacuum.setChecked(prefs.getBoolean("sqlite_auto_vacuum", false));
|
||||
swSyncExtra.setChecked(prefs.getBoolean("sqlite_sync_extra", true));
|
||||
swUnicode61.setChecked(prefs.getBoolean("sqlite_unicode61", false));
|
||||
|
||||
int sqlite_cache = prefs.getInt("sqlite_cache", DB.DEFAULT_CACHE_SIZE);
|
||||
Integer cache_size = DB.getCacheSizeKb(getContext());
|
||||
|
||||
@@ -56,9 +56,8 @@ public class Fts4DbHelper extends SQLiteOpenHelper {
|
||||
}
|
||||
|
||||
static SQLiteDatabase getInstance(Context context) {
|
||||
boolean exists = context.getDatabasePath(DATABASE_NAME).exists();
|
||||
if (instance == null || !exists) {
|
||||
if (!exists) {
|
||||
if (instance == null) {
|
||||
if (!context.getDatabasePath(DATABASE_NAME).exists()) {
|
||||
Fts5DbHelper.delete(context);
|
||||
DB.getInstance(context).message().resetFts();
|
||||
}
|
||||
@@ -74,8 +73,8 @@ public class Fts4DbHelper extends SQLiteOpenHelper {
|
||||
// https://www.sqlite.org/fts3.html#tokenizer
|
||||
// https://unicode.org/reports/tr29/
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
boolean unicode61 = prefs.getBoolean("sqlite_unicode61", false);
|
||||
String tokenizer = (unicode61 ? "tokenize=unicode61 \"remove_diacritics=2\"" : null);
|
||||
boolean unicode61 = prefs.getBoolean("unicode61", BuildConfig.DEBUG);
|
||||
String tokenizer = (unicode61 ? "tokenize=unicode61 \"remove_diacritics=0\"" : null);
|
||||
|
||||
db.execSQL("CREATE VIRTUAL TABLE `message`" +
|
||||
" USING fts4" +
|
||||
|
||||
@@ -50,12 +50,8 @@ public class Fts5DbHelper extends SQLiteOpenHelper {
|
||||
}
|
||||
|
||||
static SQLiteDatabase getInstance(Context context) {
|
||||
boolean exists = context.getDatabasePath(DATABASE_NAME).exists();
|
||||
if (instance == null || !exists) {
|
||||
if (!exists)
|
||||
DB.getInstance(context).message().resetFts();
|
||||
if (instance == null)
|
||||
instance = new Fts5DbHelper(context);
|
||||
}
|
||||
return instance.getWritableDatabase();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user