Searching for an Exact Email Address

David Bremner david at
Sun Feb 2 09:00:52 PST 2020

Kevin Foley <kevin at> writes:

> David Bremner <david at> writes:
>> Also useful is setting NOTMUCH_DEBUG_QUERY in the environment. This will
>> show the parsed Xapian query. In my case this shows both
>> 'to:"example at"' and to:"example at" end up parsed the
>> same way, so I guess the problem is elsewhere.
> I should have mentioned that I tried using NOTMUCH_DEBUG_QUERY with many
> different quoting variations and kept getting the same final query:
> Query((Tmail AND (XTOexample at 1 PHRASE 3 XTOemail at 2 PHRASE 3 XTOcom at 3)))
> It looks like the punctuation is being stripped; I get the same final
> query for `notmuch search 'to:"example email com"'`.  Is this the
> expected behavior?

Yes, that's how phrases work.

> I tried this as well but per notmuch-search-terms(7) it looks like regex
> isn't supported for the "to" field.

Ah right. it's really an implimentation quirk that that From: addresses
are stored in the form needed for regex searching.

> Also as a side note, I don't think the quoting is necessary as per the
> "searching" documentation [0], "... e-mail addresses are also treated as
> phrases.".

Quoting is certainly necessary for phrases containing spaces, but yes,
as documented phrases can also be built with punctuation.

More information about the notmuch mailing list