lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Joshua O'Madadhain" <>
Subject Re: definite matching
Date Wed, 23 Oct 2002 17:41:59 GMT
Mr. Toaster (or can I just call you "Stray"? ;> ):

Everything Peter (and Otis) said is true.  

A point of clarification that may forestall future confusion: the "+" and
"-" terms correspond to "required" and "prohibited", respectively, in a
BooleanQuery.  (Calling it a BooleanQuery is a slight misnomer to my way
of thinking, since as Peter implied, the semantics of "-" aren't quite the
same as "NOT", since you can't just search for "NOT foo".)

So to summarize:
* "+": documents *without* this term/phrase are *not* returned
* "-": documents *with* this term/phrase are *not* returned
* default (no flag): documents with this term/phrase get a higher score
  (all other things being equal) than documents which lack it.
* terms/phrases cannot be specified to be both required and prohibited.

Personally I'd stick with "+" and "-" rather than using the Boolean terms,
simply because I seem to recall that there are some constructs involving
Boolean connectives that don't behave quite the way that you might expect.
(Anyone know what happens if you search for "jam OR NOT(toast AND

Good luck--


On Wed, 23 Oct 2002, Peter Carlson wrote:

> Anyway if you want to only find documents with a given term or set of 
> terms put a + in front of EACH term you are searching for
> +hello +world
> You can also use the AND construct if you are using the QueryParser.
> hello AND world
> this gets translated into
> +hello +world
> The other options are to have a minus sign (-) which will returns 
> documents that don't have that term
> +hello -world
> will find all documents with the term hello and not world.
> Note: You cannot use the - option alone.
> Also you can use NOT in the same way
> hello NOT world
> results in
> hello -world
> Finally the OR operator (the current default) operator between terms
> hello world
> or equivalently
> hello OR world
> will find all documents with hello or world in the field. Per
  Joshua O'Madadhain: 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