You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Leonid Portnoy <le...@db.com> on 2004/05/13 21:38:00 UTC
BooleanQuery.add()
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
Re: BooleanQuery.add()
Posted by Doug Cutting <cu...@apache.org>.
Leonid Portnoy wrote:
> Am I misunderstanding something here, or is the documentation unclear?
The documentation is unclear. Can you propose an improvement?
Doug
---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org