Hello,
in fact I was facing similar problems before, however the problem is
more of a Lucene problem than a Hibernate Search one.
Sure, but it doesn't mean
HS can't solve it :)
There are some threads regarding "error tolerant" query
parsers on
the Lucene mailing list. There are several approaches to the problem.
You could catch the ParseException and inspect the error message.
According to some post it should be possible to extract the cause of
the
error from the excpetion and maybe modify the query. A simpler
approach might be to use QueryParser.escape() in case a
ParseException occurs and
just escape the whole query string.
You're right, the parsing error is quite
well described (not in string
form, but "programatically") in the exception. So implementing what I
wrote about earlier would be even easier that I suspected. I'll let
you know when I'm done with it :).
I think just using QueryParser.parse() out of the box is most of the
times not sufficient and you always have to write some custom code
around query
generation and handling. The question is whether any custom parser
is generic enough to be used in a wide range of applications. I like
the idea of a google
like query parser though. I wonder how Nutch is works in this area.
Well, as I
wrote, I think that supporting Google-like queries would be
a good "generic" parser. If the user builds a simple searchable
website (with Seam) and wants a "search" box to search through his
content such a parser would be what he expects to have in HS (unless
his needs are that simple to just send a "site:www.mysite.com query"
query to google :) ).
--
Adam