emacs-notmuch: A Xapian exception occurred parsing query

classic Classic list List threaded Threaded
4 messages Options
Kai Wang Kai Wang
Reply | Threaded
Open this post in threaded view
|

emacs-notmuch: A Xapian exception occurred parsing query


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!

--
_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
David Bremner-2 David Bremner-2
Reply | Threaded
Open this post in threaded view
|

Re: emacs-notmuch: A Xapian exception occurred parsing query

Kai Wang <[hidden email]> 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
_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
Olly Betts Olly Betts
Reply | Threaded
Open this post in threaded view
|

Re: emacs-notmuch: A Xapian exception occurred parsing query

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
_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
David Bremner-2 David Bremner-2
Reply | Threaded
Open this post in threaded view
|

Re: emacs-notmuch: A Xapian exception occurred parsing query

Olly Betts <[hidden email]> 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.  
_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch