[Xapian-discuss] Bug in error handling for QueryParser in PHP

Olly Betts olly@survex.com
Thu, 27 May 2004 17:22:37 +0100


On Thu, May 27, 2004 at 04:48:19PM +0100, Francis Irving wrote:
> A bug report, when queryparser handles a bad string.  I think the
> stuff Olly was doing to catch more exceptions might solve this?

Actually, no.  It's related though.

> I'm not sure if errors can be caught in PHP though, or if queryparser
> will need to return false.

Currently queryparser throws "const char *" (no, really) if the query
won't parse.  This is wrong (it dates back to when it was an integral
part of omega - it just never got changed to do something more sane).

As you suggest, returning false would be better.  Plus a method to read
the error message.

> Searching for: "foo" -- with double quotes is okay. "foo -- missing
> the last quote gives: Fatal error: unknown error in Xapian in
> [...]

The CVS HEAD will handle this better, but only because it'll try
stripping punctuation from a "bad" query, then reparsing.

Cheers,
    Olly