[PATCH] WIP: regexp matching in subjects

David Bremner david at tethera.net
Tue Jun 7 03:16:27 PDT 2016


David Bremner <david at tethera.net> writes:

> the idea is that you can run
>
> % notmuch search 'subject:rx:<your-favourite-regexp>'
>
> or
>
> % notmuch search subject:"your usual phrase search"
>
> This should also work with bindings.
> ---
>
> Here is Austin's "hack", crammed into the field processor framework.
> I seem to have broken one of the existing subject search tests with my
> recursive query parsing. I didn't have time to figure out why, yet.

A few hours sleep and I think I understand the issue.

with

        subject:"your usual phrase search"

I believe the phrase-ness (word ordering and proximity) gets lost when
using a field processor. So, since I don't know if/when this issue will
be fixed in Xapian, we should probably use a seperate prefix for regexp
search. This leads to two potential syntaxes

        subject_re:"^i am first"

        regexp:subject:"^i am first"

If we did stick with the current syntax, one could use

   subject:your-usual-phrase-search

to preserve phraseness. Note that for regexps with spaces in them, the
required quoting is a bit counterintuitive

 ./notmuch  count 'subject:"rx:Graduate Committee"'

That's a consequence of my faking "sub-prefixes". Which seemed clever at
the time, but maybe not.

d


More information about the notmuch mailing list