Re: doc: notmuch help search-terms, boolean operators

Subject: Re: doc: notmuch help search-terms, boolean operators

Date: Tue, 26 Apr 2011 19:55:14 -0400

To: Florian Friesdorf

Cc: notmuch@notmuchmail.org

From: Austin Clements


The full precedence is rather complicated, once you include all Xapian
operators and exceptions.  See
http://trac.xapian.org/browser/trunk/xapian-core/queryparser/queryparser.lemony,
particularly starting at line 1560.  Your precedence list is mostly
right, except that AND and NOT have the same precedence (and are
disambiguated by left-associativity in binary situations).

I think the real question is what we *want* notmuch to support.  My
understanding from id:"8762rq8byr.fsf@yoom.home.cworth.org" is that
things like NEAR and ADJ were intentionally omitted from the
documentation; that while notmuch inherits them from the Xapian query
parser, they aren't considered part of the "notmuch" query syntax.  I
would also classify XOR as dubious (even the Xapian docs call it
esoteric), but I'm happy to be convinced otherwise.

I'd love to know what people want from the query syntax for the
purposes of trimming down the custom query parser patch, and it would
also answer what should be documented (the current "etc" in the
documentation is just asking for trouble!).  I would propose "and",
"or", "not", "-" (and maybe "+" for symmetry, even though it's a
no-op), brackets, phrases, and wildcards, but what do other people
think?

On Tue, Apr 26, 2011 at 6:24 PM, Florian Friesdorf <flo@chaoflow.net> wrote:
>
> `notmuch help search-terms` currently states: "In addition to
> individual terms, multiple terms can be combined with Boolean operators
> ("and", "or", "not", etc.).".
>
> I would like to replace the "etc" with a full list and document the
> operator precedence.
>
> In lib/notmuch.h for notmuch_query_create I found a pointer to xapian
> docs [2], which states that AND takes precedence over OR, but nothing
> for NOT and XOR.
>
> Through playing with `notmuch tag` and `notmuch search
> --output=messages` I found:
>
> Complete list of boolean operators in order of precedence:
> - NOT
> - AND
> - XOR
> - OR
>
> Is this correct? If yes, I would extend the manpage accordingly.
>
> [2] http://xapian.org/docs/queryparser.html
>
> --
> Florian Friesdorf <flo@chaoflow.net>
>  GPG FPR: 7A13 5EEE 1421 9FC2 108D  BAAF 38F8 99A3 0C45 F083
> Jabber/XMPP: flo@chaoflow.net
> IRC: chaoflow on freenode,ircnet,blafasel,OFTC
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch
>
>

Thread: