Hello, I'm trying to get a better understanding of Lucene's search
operators as described in the documentation at

The documentation goes out of its way to identify two operators,
require and prohibit, but doesn't fully explain them against the
context of the other boolean operators.

For instance, the require operator (+) is described as:

 To search for documents that must contain "apples" and may contain
"oranges" use the query:  +apples oranges

My poor brain reads this statement as "We are looking for all
documents that contain the term apples, regardless of whether they do,
or do not, contain the word oranges."

As such, to me the equivalent expression would be just:  apples
...so I'm left to conclude that is going on that I'm not getting.

Clearly this is _not_ the same as 'apples OR oranges', which would
pick up documents without the term apples in them -- not what we want.
Nor is it the same as 'apples AND oranges', which would pick up
documents with only both terms present -- also not what we want.

Can someone explain to me what the require operator is doing, perhaps
with a simple example that contrasts it to behavior that can't be
obtained with a carefully crafted boolean expression?

Conversely, the prohibit operator (-) is called out from the NOT operator:
 To search for documents that contain "apples" but not "oranges" use
the query:  "apples" -"oranges"

I do not understand why this isn't simply equivalent to:  apples AND NOT oranges

...if it is, why all the big fuss about calling it "prohibit" and not
just another alias for NOT?
...if it isn't, then what's the difference in behavior?

The fact that the documentation calls out these operators separately,
gives them their own unique names, and describes them in different
terms is enough to make me think something very important or very
subtle is going on.

If anyone could point me at some reference material or take a moment
to explain what's going on, I'd really appreciate it.

-Walt Stoneburner, <[EMAIL PROTECTED]>

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to