BooleanQuery Does Not Work With One Query indicated as MUST_NOT
---------------------------------------------------------------

         Key: LUCENE-567
         URL: http://issues.apache.org/jira/browse/LUCENE-567
     Project: Lucene - Java
        Type: Bug

  Components: Search  
    Versions: 1.9    
 Environment: JDK 1.5, Lucene 1.9.1, Windows XP
    Reporter: Nicholaus Shupe
    Priority: Minor


The following code won't create a boolean query which will return anything but 
a passed in query:

        BooleanQuery result = new BooleanQuery();
        result.add(myQuery, BooleanClause.Occur.MUST_NOT);

I'll get no results if I use this query.  As a workaround, I have to add a 
MatchAllDocsQuery in order to get it to work.

        BooleanQuery result = new BooleanQuery();
        result.add(new MatchAllDocsQuery(), BooleanClause.Occur.SHOULD);
        result.add(myQuery, BooleanClause.Occur.MUST_NOT);

Maybe this is intended???? If so, perhaps the JavaDocs should be updated to 
indicate this.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to