mail-query

mail-query

mail-query is a Rust crate for parsing Gmail-style email search queries into a typed AST.

Project: https://github.com/planetaryescape/mail-query
Crate: https://crates.io/crates/mail-query
Docs: https://docs.rs/mail-query

Why it exists

Email search syntax is product muscle memory. People know from:, to:, has:attachment, older_than:30d, and is:unread because Gmail made those operators common.

The reusable part is the parser and AST. The non-reusable part is execution. Mxr executes the AST over SQLite, Tantivy, and local semantic chunks. Another app might execute the same AST over IMAP search, a hosted index, or a document store.

That split is the point: syntax can be shared without pretending every backend has Gmail-identical behavior.

Current mxr use

Validated 2026-06-04: mxr consumes mail-query = "0.1.0" from crates.io.
The latest crates.io release is 0.1.2.

That distinction matters. The registry version reflects public package
maintenance. The mxr-consumed version reflects what this app currently builds
against. mxr-search re-exports the AST and registers mxr-specific filters
such as is:owed-reply, is:reply-later, and dynamic is:$keyword.

Validate the local dependency:

cargo tree -p mxr-search -i mail-query

Validate the execution boundary:

rg -n "mail_query|register_filter|QueryNode" crates/search

Durable lesson

Parser parity is not execution parity. A parser can accept a term that the local product can only approximate. Good docs name that boundary instead of hiding it.

See also