The query parsing is not strict Boolean logic, here's a great writeup on the topic: https://lucidworks.com/blog/2011/12/28/why-not-and-or-and-not/
Thanks for pointing to the link. I have gone through this post. Following is mentioned in the post. Practically speaking this means that NOT takes precedence over AND which takes precedence over OR — but only if the default operator for the query parser has not been changed from the default (“Or”). If the default operator is set to “And” then the behavior is just plain weird. I have q.op set as AND. Not sure how it will behave. Kindly provide your inputs. My guess as to why the counts are the same with and without the fl term is that it's present only in docs with term2 and term3 in them perhaps? I have checked only fl:term1 and found many many more documents containing it than document having all the three terms so the results should have the documents containing only term1. Thanks, Modassar <https://lucidworks.com/blog/2011/12/28/why-not-and-or-and-not/> On Tue, Mar 15, 2016 at 9:16 PM, Erick Erickson <erickerick...@gmail.com> wrote: > The query parsing is not strict Boolean logic, here's a great > writeup on the topic: > https://lucidworks.com/blog/2011/12/28/why-not-and-or-and-not/ > > The outer "+" is simply the entire clause (of which there is only one) > must be present, i.e. it's the whole query. > > My guess as to why the counts are the same with and without the fl > term is that it's present only in docs with term2 and term3 in them > perhaps? > > Best, > Erick > > Best, > Erick > > On Tue, Mar 15, 2016 at 12:22 AM, Modassar Ather <modather1...@gmail.com> > wrote: > > Hi, > > > > Kindly help me understand the parsed queries of following three queries. > > How these parsed queries can be interpreted for boolean logic. > > Please ignore the boost part. > > > > *Query : *fl:term1 OR fl:term2 AND fl:term3 > > *"parsedquery_toString" : *"boost(+(fl:term1 +fl:term2 > > +fl:term3),int(doc_wt))", > > *matches : *50685 > > > > The above query seems to be ignoring the fl:term1 as the result of > fl:term2 > > AND fl:term3 is exactly 50685. > > > > *Query : *fl:term1 OR (fl:term2 AND fl:term3) > > *parsedquery_toString:* "boost(+(fl:term1 (+fl:term2 > > +fl:term3)),int(doc_wt))", > > *matches : *809006 > > > > *Query : *(fl:term1 OR fl:term2) AND fl:term3 > > *parsedquery_toString:* "boost(+(+(fl:term1 fl:term2) > > +fl:term3),int(doc_wt))", > > *matches : *293949 > > > > Per my understanding the terms having + is a must and must be present in > > the document whereas a term without it may or may not be present but > query > > one seems to be ignoring the first term completely. > > How the outer plus defines the behavior. E.g. *outer +* in query > +(fl:term1 > > +fl:term2 +fl:term3) > > > > Thanks, > > Modassar >