lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Carlson <carl...@bookandhammer.com>
Subject Re: PLEASE REVIEW: Updated Query Parser Syntax
Date Wed, 15 May 2002 20:14:49 GMT
Good point. I do think there needs to be more clarification that NOT cannot
be used as the only term and find any results. That is you can say

    NOT "bye bye" hello

But you cannot say

    NOT "bye bye"

However, I think you you might be wrong in describing the way NOT works with
AND and OR.

hello OR NOT "bye bye"

Will find all documents with hello AND do not have "bye bye". That is the
NOT is always based subtracting its finding from the other search results.
It never subtracts from the complete set of documents in the index.

So in practice
hello AND NOT "bye bye" (+hello -"bye bye")
hello OR NOT "bye bye" (hello -"bye bye")
hello NOT "bye bye" (hello -"bye bye")
NOT "bye bye" hello (-"bye bye" hello)

Are all equivalent because there is just one term being found and one phrase
being removed. These are not equivalent in the general case.

Does that make sense?

--Peter


On 5/15/02 8:26 AM, "Eugene Gluzberg" <drag0n2@apache.org> wrote:

> Sorry, I should have been more clear.
> 
> As far as I understand, NOT is an unary operator, and applies to the to the
> term that follows it.
> So:
> NOT "bye bye"
> is a valid query and will find all documents that do not have the phrase
> "bye bye"
> 
> if you want to do find all documents that have the set difference between
> hello and "bye bye" you will have to use the query:
> 
> hello AND NOT "bye bye"
> 
> Also it follows that,
> hello NOT "bye bye" is equivalent to:
> hello OR NOT "bye bye"
> 
> So the query hello NOT "bye bye" will find all documents that either have
> hello OR do not have "bye bye"
> 


--
To unsubscribe, e-mail:   <mailto:lucene-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-dev-help@jakarta.apache.org>


Mime
View raw message