feat: split search query into words for AND semantics

Searching for "foo bar" now matches emails containing both words rather
than the exact phrase. Each whitespace-separated term generates its own
IMAP criterion (OR SUBJECT "w" TEXT "w") — multiple top-level IMAP criteria
are ANDed by the protocol — and its own Drift LIKE clause for the local DB.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Thomas Güttler
2026-04-27 07:27:14 +02:00
co-authored by Claude Sonnet 4.6
parent 0103454e31
commit 2074046bb3
3 changed files with 32 additions and 13 deletions
+11
View File
@@ -6,6 +6,17 @@ Tasks get moved from next.md to done.md
## Tasks
## Multi-word search uses AND semantics
Searching for "foo bar" now returns emails that contain **both** words, not the exact
phrase. Fixed in `email_repository_impl.dart`:
- **IMAP search** (`searchEmails`): query is split on whitespace; each word becomes
`OR SUBJECT "word" TEXT "word"`, joined by spaces. Multiple top-level IMAP criteria
are implicitly ANDed by the protocol.
- **Local DB search** (`searchEmailsGlobal`): each word adds
`& (subject LIKE '%word%' | preview LIKE '%word%')` to the Drift where-clause.
## Navigate back to account list from inside an account
Added an "All accounts" tile (with `Icons.switch_account`) at the top of `FolderDrawer`,