Debug info: fts stats

pull/209/head
M66B 2 years ago
parent aa813c0819
commit b6f290a725

@ -290,12 +290,17 @@ public interface DaoMessage {
" AND NOT ui_hide") " AND NOT ui_hide")
LiveData<List<EntityMessage>> liveUnreadThread(long account, String thread); LiveData<List<EntityMessage>> liveUnreadThread(long account, String thread);
@Query("SELECT SUM(fts) AS fts, COUNT(*) AS total FROM message" + static String FTS_STATS = "SELECT SUM(fts) AS fts, COUNT(*) AS total FROM message" +
" JOIN folder_view AS folder ON folder.id = message.folder" + " JOIN folder_view AS folder ON folder.id = message.folder" +
" WHERE content" + " WHERE content" +
" AND folder.type <> '" + EntityFolder.OUTBOX + "'") " AND folder.type <> '" + EntityFolder.OUTBOX + "'";
@Query(FTS_STATS)
LiveData<TupleFtsStats> liveFts(); LiveData<TupleFtsStats> liveFts();
@Query(FTS_STATS)
TupleFtsStats getFts();
@Query("SELECT COUNT(*) FROM message" + @Query("SELECT COUNT(*) FROM message" +
" WHERE id IN (:ids)" + " WHERE id IN (:ids)" +
" AND (raw IS NULL OR NOT raw)") " AND (raw IS NULL OR NOT raw)")

@ -2848,6 +2848,13 @@ public class Log {
if (cursor.moveToNext()) if (cursor.moveToNext())
size += write(os, String.format("sqlite: %s\r\n", cursor.getString(0))); size += write(os, String.format("sqlite: %s\r\n", cursor.getString(0)));
} }
try {
TupleFtsStats stats = db.message().getFts();
size += write(os, String.format("fts: %d/%d %s\r\n", stats.fts, stats.total,
Helper.humanReadableByteCount(Fts4DbHelper.size(context))));
} catch (Throwable ex) {
size += write(os, String.format("%s\r\n", ex));
}
size += write(os, "\r\n"); size += write(os, "\r\n");

Loading…
Cancel
Save