Well, at root the Lucene query parser makes no claim of enforcing boolean logic. Think in terms of MUST, SHOULD and NOT instead.
Here's a good writeup... http://www.lucidimagination.com/blog/2011/12/28/why-not-and-or-and-not/ Best Erick On Mon, Jan 23, 2012 at 2:43 PM, Michael Jakl <jakl.mich...@gmail.com> wrote: > On Mon, Jan 23, 2012 at 22:05, Erick Erickson <erickerick...@gmail.com> wrote: >> Right. Essentially, the precedence is given to AND, so this is parsed >> as though it were python OR (ruby AND programming) OR "programming language" > > That's exactly what I'd expect, but the problem is that "ruby" is > marked as mandatory, that is, I don't get any articles not containing > ruby, whereas the query, as I'd interpret it, should allow articles > containing only python as well. > > Maybe another example illustrates my problem. > If I search for "awordthatdoesnotexistinmyindex AND java OR python" > (assuming that java and python occur in my index), I won't get any > articles because awordthatdoesnotexistinmyindex isn't to be found > anywhere. > > The query parser outputs: > +(+DisjunctionMaxQuery((stemmedText:awordthatdoesnotexistinmyindex)) > +DisjunctionMaxQuery((stemmedText:java)) > DisjunctionMaxQuery((stemmedText:python))) > > Is this not boolean logic as one might expect? Are clauses containing > AND always mandatory? I'm sorry to insist here, but it seems so > counter intuitive to me. > > Thanks for your patience, > Michael