Most probably LUCENE-6249 <https://issues.apache.org/jira/browse/LUCENE-6249> changes parser's behavior, for your case.
<https://issues.apache.org/jira/browse/LUCENE-6249> On Tue, Oct 27, 2015 at 5:33 AM, patel mrugesh <patelmruge...@yahoo.co.in> wrote: > Thanks for your reply Erick, > I have gone through the document provided by you. > However what I have observed is that there is difference if we parse query > with Lucene 4.10.3 and Lucene 5.2.0 onwards. > For example :Query String: lottery AND (NOT ticket)Lucene 4.x parsed it > as: +lottery +ticket > Lucene 5.1.x parsed it as: +lottery +(-ticket) > And I want result as 5.1.x produces. But as I am not planning to upgrade > lucene now so looking for fix for lucene 4.10.x. > Please could you help on this? > Thanks,Mrugesh > > > > On Monday, 26 October 2015 8:03 PM, Erick Erickson < > erickerick...@gmail.com> wrote: > > > Solr does not do strict Boolean logic, although it comes close. See: > https://lucidworks.com/blog/2011/12/28/why-not-and-or-and-not/ > > Best, > Erick > > On Sun, Oct 25, 2015 at 11:18 PM, patel mrugesh > <patelmruge...@yahoo.co.in> wrote: > > Hi All, > > We are using Lucene 4.10.3, one strange behavior we have observed when > NOT operator is used with parenthesis around. > > It looks like NOT operator is completely ignored and whatever boolean > operator was before parenthesis is applied. > > For example, document text: "lottery ticket", query: "lottery NOT > ticket". As expected, this query will not produce a match for this > document. However, if this query is slightly modified and converted to > "lottery (NOT ticket)" or "lottery AND (NOT ticket)" then match is > produced. It behaves as if query becomes "lottery AND ticket" instead, > completely ignoring NOT. > > Please somebody can shed light on this? > > Thanks,Mrugesh > > > > > > > > >