[PATCH] WIP: regexp matching in 'subject' and 'from'

Gaute Hope eg at gaute.vetsj.com
Sat Jun 11 10:34:18 PDT 2016


Tomi Ollila writes on juni 11, 2016 19:09:
> On Sat, Jun 11 2016, Gaute Hope <eg at gaute.vetsj.com> wrote:
>> Maybe we could check if the search string contains a regexp and decide
>> whether to pre-process it on the background of that? I think that would
>> make the interface more user-friendly. You'd just always use search
>> whether you decide that you need to put in some regexp or not.
> 
> You probably wanted to suggest that the command line handling in notmuch
> goes through the search terms and potentially modify it before giving
> to xapian to chew for... I think this is deliberately avoided (*) -- this
> would get out of hands so easily (if we could decide syntax)...
> 
> (*) there is some optmization done before feeding the query to xapian --
> but that does not affect interface (i.e. it could be dropped and none of
> the users' expectations would be broken...)
> 
> What one can do, is write ones own wrapper around notmuch. I have one
> that was written long before notmuch got date: searches (it mangles
> e.g 5h.. to 1234567890.. (**) and logs search and show queries
> (**) should change that to use date:... instead (i.e. date: queries w/o
> date: prefix). I "suggested" subject:/one's own subject re search w// slashes/
> which one could pretty easily write to the wrapper...
> 

Yes, that is pretty much what I meant. So that the user only needs
to know about 'search:', if it is 'search:foo' regular queryparser is
used, if it is 'search:/^foo/' it is preprocessed using the regexp
parser. Then the performance will remain the same for normal queries,
but seamlessly switch to the heavier regexp'er if necessary.

It could be done with a wrapper, but I am mainly using notmuch through
the API and astroid - where it could also be implemented of course.

-gaute


More information about the notmuch mailing list