Re: Searching for an Exact Email Address

Subject: Re: Searching for an Exact Email Address

Date: Sun, 02 Feb 2020 13:00:52 -0400

To: Kevin Foley, Teemu Likonen,


From: David Bremner

Kevin Foley <> writes:

> David Bremner <> 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:""' and to:"" 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@1 PHRASE 3 XTOemail@2 PHRASE 3 XTOcom@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.
notmuch mailing list