Re: [PATCH] WIP: regexp matching in subjects

Subject: Re: [PATCH] WIP: regexp matching in subjects

Date: Tue, 07 Jun 2016 07:16:27 -0300

To: Austin Clements

Cc: sfischme@uwaterloo.ca, Gaute Hope, notmuch

From: David Bremner


David Bremner <david@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

Thread: