lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Leonid Portnoy" <leonid.port...@db.com>
Subject BooleanQuery.add()
Date Thu, 13 May 2004 19:38:00 GMT
Hi,

The documentation for BooleanQuery.add() states : 
 
        "Adds a clause to a boolean query. Clauses may be: required which 
means that
documents which do not match this sub-query will not match the boolean 
query; prohibited which means that documents which do match this sub-query 
will not match the boolean query; or neither, in which case matched 
documents are neither prohibited from nor required to match the 
sub-query."

But, if it's neither then why add the sub-query at all? According to this, 
the presence of the sub-query should not restrict the range of documents 
returned at all, since regardless of whether the document matches the 
sub-query or not, the behavior of the super-query will be the same.

In fact, this is not the case. For example, 

BooleanQuery : 
          TermQuery(Term("dog"))    : prohibited = false, required=false
          TermQuery(Term"cat"))       : prohibited = false, required=false

returns all documents which contain either  'cat'  or 'dog', and  _only 
those_ documents. According to the documentation all documents should be 
returned, even if they contain neither 'cat' nor 'dog', since a document 
is not required to match either sub-query.

Am I misunderstanding something here, or is the documentation unclear? 

Thanks,
Leonid

---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org


Mime
View raw message