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
http://www.aviransplace.com

-----Original Message-----
From: news [mailto:[EMAIL PROTECTED] On Behalf Of Chris Nokleberg
Sent: Tuesday, June 06, 2006 4:25 PM
To: java-user@lucene.apache.org
Subject: Avoiding ParseExceptions

Hi all,

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 you
(please correct me if you know otherwise).

Does anyone have suggestions on how to accomplish this? I imagine it
could require a mix of techniques:
- pre-processing the input string (e.g. I currently escape colons)
- catching generated exceptions and using the exception info to correct
  the string and retry the query
- a modified QueryParser?

The next step is probably to compile a list of all the ways a
ParseException can be generated, but I figured I should ask if this idea
has any merit first.

Thanks,
Chris



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to