[Xapian-discuss] Need some help with spelling suggestions
Olly Betts
olly at survex.com
Sun May 17 16:03:39 BST 2009
On Sun, May 17, 2009 at 12:09:31PM +0200, Ivo Jansch - Ibuildings wrote:
> $qp->set_default_op(XapianQueryParser::FLAG_LOVEHATE |
> XapianQueryParser::FLAG_SPELLING_CORRECTION);
> $query = $qp->parse_query($queryString)
set_default_op() takes an "OP", not a combination of "FLAGs" - e.g.
XapianQuery::OP_AND - so you're setting a totally bogus value for the
default op here. With just FLAG_LOVEHATE you happen to set a valid
op value so you don't get an exception, but you won't get the behaviour
you expect.
The correct code for this is:
$query = $qp->parse_query($queryString, XapianQueryParser::FLAG_LOVEHATE | XapianQueryParser::FLAG_SPELLING_CORRECTION);
The error which is reported could be better - I'll take a look at that.
Cheers,
Olly
More information about the Xapian-discuss
mailing list