Re: [PATCH 2/2] lib: handle empty string in regexp field processors

Subject: Re: [PATCH 2/2] lib: handle empty string in regexp field processors

Date: Sat, 25 Mar 2017 08:30:00 -0300

To: notmuch@notmuchmail.org

Cc:

From: David Bremner


David Bremner <david@tethera.net> writes:

> +    if (str.size () == 0)
> +	return Xapian::Query(Xapian::Query::OP_AND_NOT,
> +			     Xapian::Query::MatchAll,
> +			     Xapian::Query (Xapian::Query::OP_WILDCARD, term_prefix));
> +

Full disclosure, this is a pretty expensive query. On an older i7, it
takes about 7.5s (elapsed) on my 466k messages to find 702 messages
without a subject.  I don't think it's a big deal, since I don't think

     notmuch search 'subject:""'

is likely to be typed by mistake.

For comparison, "grep -R '^Subject:$'" (which is not exactly the same
query,  since some messages completely lack a Subject: line).
takes about 390s (elapsed).

Thread: