Revert "Added option to enable sqlite unicode61 tokenizer"

This reverts commit 3811afe451.
pull/209/head
M66B 2 years ago
parent a904f0b0ea
commit 03d80e149b

@ -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();
}

@ -1119,17 +1119,6 @@
app:layout_constraintTop_toBottomOf="@id/swAutoVacuum"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swUnicode61"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_advanced_unicode61"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swSyncExtra"
app:switchPadding="12dp" />
<TextView
android:id="@+id/tvSqliteCache"
android:layout_width="0dp"
@ -1140,7 +1129,7 @@
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swUnicode61" />
app:layout_constraintTop_toBottomOf="@id/swSyncExtra" />
<SeekBar
android:id="@+id/sbSqliteCache"

@ -788,7 +788,6 @@
<string name="title_advanced_analyze" translatable="false">sqlite analyze</string>
<string name="title_advanced_auto_vacuum" translatable="false">sqlite auto vacuum</string>
<string name="title_advanced_sync_extra" translatable="false">sqlite sync extra</string>
<string name="title_advanced_unicode61" translatable="false">sqlite unicode61 tokenizer</string>
<string name="title_advanced_sqlite_cache" translatable="false">sqlite cache: %1$s %% - %2$s</string>
<string name="title_advanced_chunk_size" translatable="false">Chunk size: %1$d</string>
<string name="title_advanced_thread_range" translatable="false">Thread range: %1$d days</string>

Loading…
Cancel
Save