# Search the mail servers too, as Spark does · michael/spark-rs

[View on GitCafe](https://git.cafe/michael/spark-rs/commit/cc5184769d4dbbdbf7c48e8e71b755d6125e0285)

Repository: [michael/spark-rs](https://git.cafe/michael/spark-rs)

Visibility: public

Requested revision: cc5184769d4dbbdbf7c48e8e71b755d6125e0285

Requested commit: cc5184769d4dbbdbf7c48e8e71b755d6125e0285

Commit: cc5184769d4dbbdbf7c48e8e71b755d6125e0285

Tree: 99258f4cb1c815be32096de601a2fc2426c603d6

Author: Michael Rodriguez

Committer: Michael Rodriguez

## Message

```
Search the mail servers too, as Spark does

A second after the search field rests, the search also goes to every
account's server, for mail that isn't stored yet: Microsoft 365 through
Graph's $search (KQL), Gmail with X-GM-RAW, other IMAP servers with
UID SEARCH TEXT. Up to 100 of the newest hits per place are fetched and
stored like synced mail (inbox mail as reaching back stores it, folder
mail as the folder's sync does), so the full-text index has them and the
local search, run again, shows them. Trash, Junk and Drafts are left out.

The search syntax parser moves from the agents' tool into the store as
spark_store::Query, which the mail crate also translates for servers.

IMAP mail a search brings in from below the inbox floor isn't taken for
gone by the next sync, and reaching back passes over it.

The list says it's still searching rather than "No emails found" while
the servers are asked, with a spinner next to the count.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

```

## Parents

- [ac7390078dd008cf01333d0c05463a15c11d02f0](https://git.cafe/michael/spark-rs/commit/ac7390078dd008cf01333d0c05463a15c11d02f0?format=markdown)

[Source at this commit](https://git.cafe/michael/spark-rs/tree/cc5184769d4dbbdbf7c48e8e71b755d6125e0285?format=markdown)
