Well, the query parsers never promised to implement strict boolean algebra. You can emulate it with careful use of parentheses.
See: https://lucidworks.com/2011/12/28/why-not-and-or-and-not/ Best, Erick On Wed, Jun 28, 2017 at 9:30 AM, Marco Staub <marco.st...@kippdata.de> wrote: > Hi there, > > I am a litte confused about combined boolean operators in the query parser. > For example If I search for > > myfield:a AND myfield:b OR myfield:c > > This will be parsed internal to the query > > +myfield:a +myfield:b myfield:c > > But if I change the default operator to AND (q.op=AND) I got for the same > origin query: > > +myfield:a myfield:b myfield:c > > Which is BTW in both cases not pure boolean algebra: A AND B OR C should be > (A AND B) OR C > > Did anybody know why the query is handled that way? > > Version is Solr 6.5.0, the handler ist almost the default /select handler: > > <requestHandler name="/select" class="solr.SearchHandler“> > <lst name="defaults"> > <str name="echoParams">explicit</str> > <str name="df“>myfield</str> > <str name="wt">json</str> > <str name="indent">true</str> > </lst> > </requestHandler> > > Queries: > /select?debugQuery=on&indent=on&q=myfield:a AND myfield:b OR myfield:c&wt=json > /select?debugQuery=on&indent=on&q.op=AND&q=myfield:a AND myfield:b OR > myfield:c&wt=json > > See parsedquery in the result. myfield should be replaceable by any fieldname > in the index like id. > > Best > Marco