lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ian Lea <ian....@gmail.com>
Subject Re: ParseException (How escape a question?)
Date Mon, 08 Nov 2010 21:05:01 GMT
You can use QueryParser.escape(s) if you want to keep the ? and
brackets and whatever.  Or you could remove them.

One technique is to parse the query as supplied and catch the
ParseException, remove any special characters and resubmit the query.
See http://lucene.apache.org/java/3_0_2/queryparsersyntax.html#Escaping%20Special%20Characters
for a list of special characters.


--
Ian.

On Mon, Nov 8, 2010 at 8:24 PM, Celso Fontes <celsowm@gmail.com> wrote:
> How escape a question like (version 3.0.2):
>
>     "What is the role of Transforming growth factor-beta1 (TGF-beta1)
> in cerebral amyloid angiopathy (CAA)?"
>
> Exception in thread "main"
> org.apache.lucene.queryParser.ParseException: Cannot parse 'What is
> the role of Transforming growth factor-beta1 (TGF-beta1) in cerebral
> amyloid angiopathy (CAA)?': '*' or '?' not allowed as first character
> in WildcardQuery
>
> thanks,
> celso
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message