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 <cels...@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-unsubscr...@lucene.apache.org
> For additional commands, e-mail: java-user-h...@lucene.apache.org
>
>

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

Reply via email to