unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* doc: notmuch help search-terms, boolean operators
@ 2011-04-26 22:24 Florian Friesdorf
  2011-04-26 23:01 ` Carl Worth
  2011-04-26 23:55 ` Austin Clements
  0 siblings, 2 replies; 5+ messages in thread
From: Florian Friesdorf @ 2011-04-26 22:24 UTC (permalink / raw)
  To: notmuch

[-- Attachment #1: Type: text/plain, Size: 902 bytes --]


`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

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: doc: notmuch help search-terms, boolean operators
  2011-04-26 22:24 doc: notmuch help search-terms, boolean operators Florian Friesdorf
@ 2011-04-26 23:01 ` Carl Worth
  2011-04-26 23:11   ` Jameson Graef Rollins
  2011-04-26 23:29   ` Olly Betts
  2011-04-26 23:55 ` Austin Clements
  1 sibling, 2 replies; 5+ messages in thread
From: Carl Worth @ 2011-04-26 23:01 UTC (permalink / raw)
  To: Florian Friesdorf, notmuch; +Cc: Olly Betts

[-- Attachment #1: Type: text/plain, Size: 1009 bytes --]

On Wed, 27 Apr 2011 00:24:38 +0200, Florian Friesdorf <flo@chaoflow.net> wrote:
> I would like to replace the "etc" with a full list and document the
> operator precedence.

Yes, that's a fine idea.

> 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.

Currently, notmuch doesn't implement this behavior but relies on
Xapian's query parser to do so. As such, I'd really prefer to see
Xapian's documentation augmented here before we start documenting
any particular behavior in notmuch.

Olly, is the above list of operators complete and in the correct order
of  precendence?

-Carl

-- 
carl.d.worth@intel.com

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: doc: notmuch help search-terms, boolean operators
  2011-04-26 23:01 ` Carl Worth
@ 2011-04-26 23:11   ` Jameson Graef Rollins
  2011-04-26 23:29   ` Olly Betts
  1 sibling, 0 replies; 5+ messages in thread
From: Jameson Graef Rollins @ 2011-04-26 23:11 UTC (permalink / raw)
  To: Carl Worth, Florian Friesdorf, notmuch; +Cc: Olly Betts

[-- Attachment #1: Type: text/plain, Size: 677 bytes --]

On Tue, 26 Apr 2011 16:01:17 -0700, Carl Worth <cworth@cworth.org> wrote:
> > Complete list of boolean operators in order of precedence:
> > - NOT
> > - AND
> > - XOR
> > - OR
> > 
> > Is this correct? If yes, I would extend the manpage accordingly.
> 
> Currently, notmuch doesn't implement this behavior but relies on
> Xapian's query parser to do so. As such, I'd really prefer to see
> Xapian's documentation augmented here before we start documenting
> any particular behavior in notmuch.

It would be nice if the notmuch documentation did mention the available
operators, though.  For instance, I had no idea that XOR was a supported
operator.

jamie.

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: doc: notmuch help search-terms, boolean operators
  2011-04-26 23:01 ` Carl Worth
  2011-04-26 23:11   ` Jameson Graef Rollins
@ 2011-04-26 23:29   ` Olly Betts
  1 sibling, 0 replies; 5+ messages in thread
From: Olly Betts @ 2011-04-26 23:29 UTC (permalink / raw)
  To: Carl Worth; +Cc: notmuch

On Tue, Apr 26, 2011 at 04:01:17PM -0700, Carl Worth wrote:
> On Wed, 27 Apr 2011 00:24:38 +0200, Florian Friesdorf <flo@chaoflow.net> wrote:
> > 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.
> 
> Currently, notmuch doesn't implement this behavior but relies on
> Xapian's query parser to do so. As such, I'd really prefer to see
> Xapian's documentation augmented here before we start documenting
> any particular behavior in notmuch.
> 
> Olly, is the above list of operators complete and in the correct order
> of  precendence?

Close, but actually AND and NOT have equal precedence.

Also, NEAR and ADJ bind tighter than AND or NOT.

And '+' and '-' tightest of all.

I'll try to make sure this gets documented.

Cheers,
    Olly

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: doc: notmuch help search-terms, boolean operators
  2011-04-26 22:24 doc: notmuch help search-terms, boolean operators Florian Friesdorf
  2011-04-26 23:01 ` Carl Worth
@ 2011-04-26 23:55 ` Austin Clements
  1 sibling, 0 replies; 5+ messages in thread
From: Austin Clements @ 2011-04-26 23:55 UTC (permalink / raw)
  To: Florian Friesdorf; +Cc: notmuch

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
>
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-04-26 23:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-26 22:24 doc: notmuch help search-terms, boolean operators Florian Friesdorf
2011-04-26 23:01 ` Carl Worth
2011-04-26 23:11   ` Jameson Graef Rollins
2011-04-26 23:29   ` Olly Betts
2011-04-26 23:55 ` Austin Clements

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).