lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joshua O'Madadhain <>
Subject RE: Lucene Query Structure
Date Tue, 19 Feb 2002 22:21:55 GMT
On Tue, 19 Feb 2002, Doug Cutting wrote:

[in response to my confusion on the semantics of BooleanQuery]

> OR is not inherently binary.

<blink> Well, OK, if you want to define it that way.  I usually think of
OR as being k-ary for k >= 2.  I guess you are defining unary OR as just
the value of its input (OR(T) = T, OR(F) = F).  The reason why this seems
counterintuitive to me is that the most obvious semantics for unary AND
would be identical.

> Good analogies for the semantics of BooleanQuery are most internet
> search engines (except Google) which permit you to put '+' or '-' in
> front of a word to require or prohibit it.  (Google requires terms by
> default.)  A term with no plus or minus is not required for a match,
> but all of the documents containing it are included.

Okay, I think I finally understand how this is working.  If we express
the semantics of (required, prohibited) in terms of their impact on the
score for a document D and query q, we get:

(true, false): if q is not satisfied by D, score(D) is set to 0; 
otherwise the score is calculated as specified in the FAQ. [AND]

(false, true): if q *is* satisfied by D, score(D) = 0; otherwise,
the score is calculated as in the FAQ. [NAND]

(false, false): The score is calculated as in the FAQ.  [(implicit) OR]

In other words, BooleanQuery does two things:  
(a) provides a mechanism for searching on multiple independent terms
(b) allows the user to compose the document score function (for the vector
model of IR) with threshold functions whose behavior is specified by
certain types of Boolean operators.
(If I am still out in left field, corrections would be welcome.)

Doug, thank you for taking the time to clear this up for me.  You've been
very helpful.


Joshua O'Madadhain Per
    Joshua Madden: Information Scientist, Musician, Philosopher-At-Tall
 It's that moment of dawning comprehension that I live for--Bill Watterson
My opinions are too rational and insightful to be those of any organization.

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message