Chris Nokleberg wrote:
I am using the QueryParser with a StandardAnalyzer. I would like to avoid
or auto-correct anything that would lead to a ParseException. For example,
I don't think you can get a parse exception from Google--even if you omit
a closing quote it looks like it just closes it for
On Tue, 06 Jun 2006 14:57:06 -0700, Chris Hostetter wrote:
> I took an approach similar to that, by escaping all of the "special'
> characters except '+', '-', and '"', and then stripping out all quotes if
> there was a non even amount ... this gave me a simplified version of the
> Lucene syntax th
It really depends on what syntax you want to support ... if you just want
basic term matching and do't want to let hte user specify field names, or
boosts or phrases, or ranges, or wildcards -- then just escape the
entirestring, that should make it impossible to get a parse exception.
I took an a
That way madness lies..
I suspect that you'll find that there are a few rules you can apply that
will allow you to "fix" a lot of queries, but... is that really what you
want to do? For instance, a user types
"a and or not b"
Whatever you do, it isn't what the *next* user who types somethin
Basically you need to pre-process the query and rewrite it in a way you
think it should be. Then catch the parse exception if you failed to
rewrite the query and display an error message on the screen (something
like - This kind of query is not supported, please rephrase your query).
HTH
Aviran
h