lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Erick Erickson" <erickerick...@gmail.com>
Subject Re: Better parsing of Queries
Date Wed, 04 Apr 2007 21:55:40 GMT
About all you can do is roll your own. I suspect a decent regular
expression would work, or you could let Lucene escape the
query and then re-replace all \: with :

Erick

On 4/4/07, Simon Wistow <simon@thegestalt.org> wrote:
>
> I'm looking for some advice on dealing with malformed queries.
>
> If a user searches for "yow!" then I get an exception from the query
> parser. I can get round this by using QueryParser.escape(query) first
> but then that prevents them from searching using other bits of the the
> query syntax such as "author:alice".
>
> Is there an easy way to get a query such as
>
>     "yow! author:alice"
>
> and get back
>
>     "yow\! author:alice"
>
> i.e only escape the special characters when they don't make sense?
>
> Simon
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message