From 066531555b2d6cfdff826c6a5332760ff453c3bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Padez?= Date: Thu, 23 Jul 2026 17:43:37 +0000 Subject: [PATCH] =?UTF-8?q?todo:=20extend=20email=20search=20with=20Gmail-?= =?UTF-8?q?style=20operators=20(from:,=20subject:,=20has:attachment,=20?= =?UTF-8?q?=E2=80=A6)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.8 --- TODO.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/TODO.md b/TODO.md index 0267adea..76644622 100644 --- a/TODO.md +++ b/TODO.md @@ -25,6 +25,20 @@ Deferred work. Context: Officer is collapsing from multi-tenant / open-source-re under `dev-data/{email}/home`, per-user server state (dock, user apps, AppRegistry keyed by email), and auth (passkeys-per-origin, JWT signin, unmounted `PasskeyGate`). +## Email + +- [ ] **Gmail-style search operators.** Extend the FTS5 search (`/email/search`, `searchEmails` + + `toFtsQuery` in `api/email/email-db.ts`) to parse structured operators like `from:`, `to:`, + `subject:`, `has:attachment`, `label:`, `before:`/`after:` (dates), `is:unread`, quoted phrases, + and `OR`. Today `toFtsQuery` just does per-term prefix-AND across all columns. + Approach: split the query into (a) **field-scoped text** → FTS5 column filters (the `emails_fts` + table already has named columns `subject`/`sender`/`recipients`/`snippet`/`body`, so + `subject:foo` → `{subject}:"foo"*` in the MATCH; `from:x` → the `sender` column) and (b) + **structured filters** applied as SQL `WHERE` alongside the MATCH — `has:attachment` → + `attachment_count > 0`, `before:/after:` → `date` range, `is:unread` → `read = 0`, `label:` → + `labels LIKE`. Free text stays full-text. Frontend: keep the single search box (operators are + typed inline, Gmail-style) — no UI change needed beyond maybe a hint/legend. + ## Known bugs - [ ] **`bootstrap.ts` runs `npm install -g` for Pi on every boot.** `findPiPackageDir` checks stale