I think this is related to http://search-lucene.com/m/lM9CXH2Pl7
Also as explained here http://search-lucene.com/m/g4JmKSGMaI/ it is better to use + - operator rather than OR AND NOT parenthesis. http://wiki.apache.org/lucene-java/BooleanQuerySyntax Just for your information: There is no such syntax 'date <= 2010-12-15' that returns documents having date less than or equal to 2010-12-15. --- On Wed, 12/15/10, Tommaso Teofili <tommaso.teof...@gmail.com> wrote: > From: Tommaso Teofili <tommaso.teof...@gmail.com> > Subject: Parenthesis in query string > To: solr-user@lucene.apache.org > Date: Wednesday, December 15, 2010, 7:24 PM > Hi all, > I've just noticed a strange behavior (or, at least, I > didn't expect that), > when adding useless parenthesis to a query. > Using the lucene query parser in Solr I get no results with > the query: > > * ((( NOT (text:"something"))) AND date <= 2010-12-15) > * > > while I get the expected results when the query is : > > *( NOT (text:"something") AND date <= 2010-12-15) * > > Setting the debugQuery=true param I get this for the first > query sample: > <str name="rawquerystring"> > ((( NOT (text:"something"))) AND data <= 2010-12-15) > </str> > <str name="querystring"> > ((( NOT (text:"something"))) AND data <= 2010-12-15) > </str> > <str name="parsedquery"> > +(-PhraseQuery(text:"something")) +text:dat > PhraseQuery(text:"2010 12 15") > </str> > <str name="parsedquery_toString"> > +(-text:"something") +text:dat text:"2010 12 15" > </str> > > while I get the following in the second (right) query > sample: > <str name="rawquerystring"> > ( NOT (text:"something") AND data <= 2010-12-15) > </str> > <str name="querystring"> > ( NOT (text:"something") AND data <= 2010-12-15) > </str> > <str name="parsedquery"> > -PhraseQuery(text:"something") +text:dat > PhraseQuery(text:"2010 12 15") > </str> > <str name="parsedquery_toString"> > -text:"something" +text:dat text:"2010 12 15" > </str> > > Is that something expected and I am missing something or > it's a bug? > Thanks in advance. > Regards, > Tommaso >