I have set <solrQueryParser defaultOperator="AND"/> in the schema (and restarted Solr), and tested again with
http://localhost:8983/solr/collection1/browse?defType=edismax&q=(Thomas+Michael)+OR+xxxmatchesnothingxxx&q.op=AND note the extra parameter. Still it returns the 7 documents that matches (Thomas OR Michael), but not (Thomas AND Michael). The only way to enforce an implicit AND is by changing the query into http://localhost:8983/solr/collection1/browse?defType=edismax&q=(%2BThomas+%2BMichael)+OR+%2Bxxxmatchesnothingxxx But then the AND isn't implicit anymore...and I don't like to prefix all my search terms with a +. -----Original Message----- From: Shawn Heisey [mailto:s...@elyograg.org] Sent: Wednesday 12 December 2012 05:46 To: solr-user@lucene.apache.org Subject: Re: edismax: implicit AND changes into implicit OR On 12/12/2012 5:51 AM, Burgmans, Tom wrote: > I have some documents indexed; 3 of them contain "Thomas" and 4 of > them contain "Michael", but none of the contain both. A search for > > http://localhost:8983/solr/collection1/browse?defType=edismax&q=(Thomas+Michael) > <http://localhost:8983/solr/collection1/browse?defType=edismax&q=%28Thomas+Michael%29> > > returns 0 results as expected since there is an implicit AND between > the two terms and there is no document that matches both. But a search > for > > http://localhost:8983/solr/collection1/browse?defType=edismax&q=(Thomas+Michael)+OR+xxxmatchesnothingxxx > <http://localhost:8983/solr/collection1/browse?defType=edismax&q=%28Thomas+Michael%29+OR+xxxmatchesnothingxxx> > > returns 7 results. For some reason the implicit AND turns into an > implicit OR, in case an Explicit OR is added to the query expression. > The parsedquery information confirms this behavior. > > I'll give you my best guess, nothing to back this up but instinct. The following statements (especially the second one) may be wrong: When you do not include any boolean operators, edismax is using its "mm" parameter, which defaults to 100%, meaning that all search terms must match (equivalent to a default operator of AND). When you DO include a boolean operator, mm goes out the window and edismax reverts to using the default operator for solr, your schema, or the request handler, which unless you have changed it, is OR. Thanks, Shawn This email and any attachments may contain confidential or privileged information and is intended for the addressee only. If you are not the intended recipient, please immediately notify us by email or telephone and delete the original email and attachments without using, disseminating or reproducing its contents to anyone other than the intended recipient. Wolters Kluwer shall not be liable for the incorrect or incomplete transmission of of this email or any attachments, nor for unauthorized use by its employees. Wolters Kluwer nv has its registered address in Alphen aan den Rijn, The Netherlands, and is registered with the Trade Registry of the Dutch Chamber of Commerce under number 33202517.