First, I highly, highly recommend you get a copy of Luke to examineyour index. It'll also help you understand the role of Analyzers.
Your first problem is that StandardAnalyzer probably removes the open and close parens. See: http://lucene.apache.org/java/2_4_1/api/index.html so you can't search on them *even if* you escape the terms in your query parsing correctly, see: http://lucene.apache.org/java/2_3_2/queryparsersyntax.html#Escaping Special Characters You want to understand the implications of whatever analyzer you choose, or progress will be...er...difficult <G>. Luke will allow you to try different Analyzers and see the results of parsing queries, which will be a fine place to start... Best Erick On Wed, Jun 24, 2009 at 1:30 PM, Radha Sreedharan <radh...@gmail.com> wrote: > Hi all, > > I am using a Standard analyzer on both my search field and my query. > I use a SpanNearQuery to search on the search field. > One of the query terms has special characters like ( - round open bracket > and ) - round close bracket : How does Lucene handle this? > Also, the search field has ( and ) : How does Lucene handle this? Is it > treated as white space and ignored? > > Is it possible to search for special characters ? ie if my query has ) then > it should search for it and only if my search field has ) , it should give > me a hit. > > Regards, > Radha >