Hi!
That's correct.
'to' word is a part of the syntax, so it could be used only within a
phrase:
$index->find("\"out to lunch\"");
You can also take reserved words into double-quotes to escape them from
interpretation as a part of syntax:
$index->find('out "to" lunch');
I am not sure what is the best way for user friendly searching...
I think, good idea is to parse query before searching and make some
transformations if exception is thrown:
------------------------------------------
try {
$parsedQuery = Zend_Search_Lucene_Search_QueryParser::parse($query);
} catch (Zend_Search_Lucene_Search_QueryParserException $e) {
...
$parsedQuery =
Zend_Search_Lucene_Search_QueryParser::parse($modifiedQuery);
}
$hits = $index->find($parsedQuery);
PS Wildcard queries support is done now. You cant take it with an SVN
version or any of the latest snapshots.
With best regards,
Alexander Veremyev.
> -----Original Message-----
> From: nickpdx [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, August 29, 2007 11:41 PM
> To: [email protected]
> Subject: [fw-general] Zend_Search_Lucene syntax error
> exception when searching on "to"
>
>
> If you give the find() method a search query like "{alpha to
> bravo}" it reports "Range queries not supported yet" which
> seems like a normal error.
> But if the user legitimately searches for a phrase like "out
> to lunch",
> find() throws this exception:
>
> Zend_Search_Lucene_Search_QueryParserException Object (
> [message:protected] => Syntax error at char position 5.
> [string:private] =>
> [code:protected] => 0
> [file:protected] =>
> /home/neby/php5/Zend/Search/Lucene/Search/QueryParser.php
> [line:protected] => 353
> ........
> )
>
> Perhaps someone can tell me whether to file a Jira issue on
> this. I searched but wasn't finding an open issue that
> seemed to be related - but I know how great it is when
> someone submits bug reports on something that's already been
> reported/worked. If I don't see any feedback on the list in
> a few days I'll file an issue report.
> --
> View this message in context:
> http://www.nabble.com/Zend_Search_Lucene-syntax-error-exceptio
> n-when-searching-on-%22to%22-tf4349915s16154.html#a12394266
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
>