Re: notmuch command-line arguments are not <search-term>s

Subject: Re: notmuch command-line arguments are not <search-term>s

Date: Tue, 25 Mar 2025 13:48:58 +0100

To: Tomi Ollila

Cc: Ian! D. Allen, notmuch@notmuchmail.org

From: Michael J Gruber


Am Di., 25. März 2025 um 11:32 Uhr schrieb Tomi Ollila <tomi.ollila@iki.fi>:
>
> On Tue, Mar 25 2025, David Bremner wrote:
>
> > "Ian! D. Allen" <idallen@idallen.ca> writes:
> >
> >> Summary (TL;DR): The notmuch man page SYNOPSIS shows blank-separated
> >> command-line arguments labelled "<search-term>", but these are not
> >> search terms; these command-line arguments are merely pieces of
> >> arbitrary text concatenated together, separated by blanks, into one
> >> long query string that is then parsed for search terms.  Calling
> >> command-line arguments <search-term> is wrong.
> >
> > In general if you want better error reporting I strongly suggest you
> > switch to the s-exp query parser.
>
> Too long for you, David ? >;D
>
> What is right or wrong is arguably, but sure, that part of the namual pages
> could be improved. How to make that "best enough" is harder to decide :D

Use the source, Luke:
```
 * Currently, the arguments are just connected with space characters,
 * but we might do more processing in the future, (such as inserting
 * any AND operators needed to work around Xapian QueryParser bugs).
```
Also, the OP quoted the man page partly only:
```
   Operators
       In  addition to individual terms, multiple terms can be
combined with Boolean operators (and, or, not, and xor). Each term in
the query will be implic‐
       itly connected by a logical AND if no explicit operator is
provided (except that terms with a common prefix will be implicitly
combined with OR).
```
In particular, it's not as simple as `arg1 AND arg2` instead of `arg1
arg2`. The meaning of the space depends on context, which is arguably
syntactically questionable but tailored to the common use cases. I
certainly prefer consistency over convenience because the latter will
lead to surprises sooner or later, but that's a different issue.
I have not checked whether that "space parsing" is part of Xapian or
of notmuch's query parser.

As for the term "term": As soon as you want to use operators without
quoting, individual args are not complete "terms" any more. But don't
get me started on quoting ;-)

Cheers
Michael
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: