mirror of
https://github.com/M66B/FairEmail.git
synced 2025-12-30 01:21:11 +01:00
Improved search performance
This commit is contained in:
@@ -212,6 +212,19 @@ public interface DaoMessage {
|
||||
List<Long> getMessageByFolder(long folder);
|
||||
|
||||
@Query("SELECT id" +
|
||||
" FROM message" +
|
||||
" WHERE (:folder IS NULL OR folder = :folder)" +
|
||||
" AND NOT ui_hide" +
|
||||
" ORDER BY message.received DESC")
|
||||
List<Long> getMessageIdsByFolder(Long folder);
|
||||
|
||||
@Query("SELECT id, account, thread, (:find IS NULL" +
|
||||
" OR `from` LIKE :find COLLATE NOCASE" +
|
||||
" OR `to` LIKE :find COLLATE NOCASE" +
|
||||
" OR `cc` LIKE :find COLLATE NOCASE" +
|
||||
" OR `subject` LIKE :find COLLATE NOCASE" +
|
||||
" OR `keywords` LIKE :find COLLATE NOCASE" +
|
||||
" OR `preview` LIKE :find COLLATE NOCASE) AS matched" +
|
||||
" FROM message" +
|
||||
" WHERE (:folder IS NULL OR folder = :folder)" +
|
||||
" AND NOT ui_hide" +
|
||||
@@ -222,7 +235,7 @@ public interface DaoMessage {
|
||||
" WHEN 1 THEN message.ui_snoozed IS NOT NULL" +
|
||||
" ELSE 1 END" + // NULL: true
|
||||
" ORDER BY message.received DESC")
|
||||
List<Long> getMessageIdsByFolder(Long folder, Boolean seen, Boolean flagged, Boolean snoozed);
|
||||
List<TupleMatch> matchMessages(Long folder, String find, Boolean seen, Boolean flagged, Boolean snoozed);
|
||||
|
||||
@Query("SELECT id" +
|
||||
" FROM message" +
|
||||
@@ -364,16 +377,6 @@ public interface DaoMessage {
|
||||
" ORDER BY sender, subject")
|
||||
Cursor getSuggestions(String query);
|
||||
|
||||
@Query("SELECT * FROM message" +
|
||||
" WHERE id = :id" +
|
||||
" AND (`from` LIKE :find COLLATE NOCASE" +
|
||||
" OR `to` LIKE :find COLLATE NOCASE" +
|
||||
" OR `cc` LIKE :find COLLATE NOCASE" +
|
||||
" OR `subject` LIKE :find COLLATE NOCASE" +
|
||||
" OR `keywords` LIKE :find COLLATE NOCASE" +
|
||||
" OR `preview` LIKE :find COLLATE NOCASE)")
|
||||
EntityMessage match(long id, String find);
|
||||
|
||||
@Insert
|
||||
long insertMessage(EntityMessage message);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user