unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* emacs-notmuch: A Xapian exception occurred parsing query
@ 2018-02-06  2:52 Kai Wang
  2018-02-07 10:58 ` David Bremner
  0 siblings, 1 reply; 4+ messages in thread
From: Kai Wang @ 2018-02-06  2:52 UTC (permalink / raw)
  To: notmuch


When I use emacs-notmuch, in the notmuch-search mode, I press 't' and
select a tag, it gives a parsing query error:

======================================================================

[Tue Feb  6 10:41:04 2018]
notmuch search: A Xapian exception occurred
A Xapian exception occurred parsing query: Syntax: <expression> AND <expression>
Query string was: * and tag:flagged
command: /usr/local/bin/notmuch search --format\=sexp --format-version\=4 --sort\=newest-first \*\ and\ tag\:flagged
exit status: 1
stderr:
notmuch search: A Xapian exception occurred
A Xapian exception occurred parsing query: Syntax: <expression> AND <expression>
Query string was: * and tag:flagged

======================================================================

I know that may not a matter of notmuch, but I don't know where to ask
for the help.

Thank you!

--

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

* Re: emacs-notmuch: A Xapian exception occurred parsing query
  2018-02-06  2:52 emacs-notmuch: A Xapian exception occurred parsing query Kai Wang
@ 2018-02-07 10:58 ` David Bremner
  2018-02-15 23:54   ` Olly Betts
  0 siblings, 1 reply; 4+ messages in thread
From: David Bremner @ 2018-02-07 10:58 UTC (permalink / raw)
  To: Kai Wang, notmuch

Kai Wang <kaiwkx@gmail.com> writes:

> When I use emacs-notmuch, in the notmuch-search mode, I press 't' and
> select a tag, it gives a parsing query error:
>
> ======================================================================
>
> [Tue Feb  6 10:41:04 2018]
> notmuch search: A Xapian exception occurred
> A Xapian exception occurred parsing query: Syntax: <expression> AND <expression>
> Query string was: * and tag:flagged
> command: /usr/local/bin/notmuch search --format\=sexp --format-version\=4 --sort\=newest-first \*\ and\ tag\:flagged
> exit status: 1
> stderr:
> notmuch search: A Xapian exception occurred
> A Xapian exception occurred parsing query: Syntax: <expression> AND <expression>
> Query string was: * and tag:flagged
>

Hi Kai;

Thanks for the report.  This is a more or less known problem with "*";
if you try 't' in any other search it should work.

The underlying issue is that * is parsed (simplistically) by notmuch
before passing to Xapian, so only works if it is the entire query.

For cases like you report, where the user has not entered '*', but
rather it is contained in some generated query string, we could fix the
problem by adding a prefix like "special:*". This would allow Xapian to
parse it, but only for Xapian versions >= 3.5.  How many users of older
systems do we think this would affect? E.g. users of Debian oldstable
(jessie) would have to compile Xapian in order to use the newest
notmuch.

d

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

* Re: emacs-notmuch: A Xapian exception occurred parsing query
  2018-02-07 10:58 ` David Bremner
@ 2018-02-15 23:54   ` Olly Betts
  2018-03-18 13:49     ` David Bremner
  0 siblings, 1 reply; 4+ messages in thread
From: Olly Betts @ 2018-02-15 23:54 UTC (permalink / raw)
  To: notmuch

On 2018-02-07, David Bremner wrote:
> The underlying issue is that * is parsed (simplistically) by notmuch
> before passing to Xapian, so only works if it is the entire query.
>
> For cases like you report, where the user has not entered '*', but
> rather it is contained in some generated query string, we could fix the
> problem by adding a prefix like "special:*".

If you're generating the query string, you could presumably just
generate « tag:flagged » for this case.

Though it's generally better not to try to generate a string to parse,
but instead to parse any part(s) the user actually wrote and combine
the resulting Xapian::Query objects with directly constructed objects
for other filters, etc.

> This would allow Xapian to parse it, but only for Xapian versions >=
> 3.5.  How many users of older systems do we think this would affect?
> E.g. users of Debian oldstable (jessie) would have to compile Xapian
> in order to use the newest notmuch.

(That should be >= 1.3.5 I think - certainly 3.5 is wrong).

For Debian oldstable users, there's a backport of 1.4.3:

https://packages.debian.org/source/oldstable-backports/xapian-core

Cheers,
    Olly

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

* Re: emacs-notmuch: A Xapian exception occurred parsing query
  2018-02-15 23:54   ` Olly Betts
@ 2018-03-18 13:49     ` David Bremner
  0 siblings, 0 replies; 4+ messages in thread
From: David Bremner @ 2018-03-18 13:49 UTC (permalink / raw)
  To: Olly Betts, notmuch

Olly Betts <olly@survex.com> writes:

> On 2018-02-07, David Bremner wrote:
>> The underlying issue is that * is parsed (simplistically) by notmuch
>> before passing to Xapian, so only works if it is the entire query.
>>
>> For cases like you report, where the user has not entered '*', but
>> rather it is contained in some generated query string, we could fix the
>> problem by adding a prefix like "special:*".
>
> If you're generating the query string, you could presumably just
> generate « tag:flagged » for this case.

Yes, that should in principle be a Simple Matter of Programming
(TM). But this doesn't affect the underlying infelicity that

"*" is a valid notmuch query, while

"* and tag:foo" is not

>
> Though it's generally better not to try to generate a string to parse,
> but instead to parse any part(s) the user actually wrote and combine
> the resulting Xapian::Query objects with directly constructed objects
> for other filters, etc.
>

That's a bit tougher here, since the emacs interface is calling the
notmuch CLI with query strings.  

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

end of thread, other threads:[~2018-03-18 13:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-06  2:52 emacs-notmuch: A Xapian exception occurred parsing query Kai Wang
2018-02-07 10:58 ` David Bremner
2018-02-15 23:54   ` Olly Betts
2018-03-18 13:49     ` David Bremner

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