Hi,
I don't really get this. I've just run into this same problem, but after a
discussion in the zftalk IRC channel it seems searching for "foo to bar"
works for other people without an error?
I had assumed there would be a way to throw any query string possible at
Zend_Search_Lucene_Search_QueryParser::parse and it would make the best of
it, without error.
I mean, one of the most common uses of a search component is to just have a
simple text input search box on a page. Given that anything could be typed
into that, it should accept it. You can't expect users to learn how to
format search strings correctly, nor can you just throw an error at them
when they typed something that usually has special meaning.
Am I mistaken? Is there a way to do this? And why does it seem to work for
some people but not me?
Thanks in advance,
Jack
Alexander Veremyev wrote:
>
> 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.
>
--
View this message in context:
http://www.nabble.com/Zend_Search_Lucene-syntax-error-exception-when-searching-on-%22to%22-tf4349915s16154.html#a13385744
Sent from the Zend Framework mailing list archive at Nabble.com.