[jira] Created: (LUCENE-567) BooleanQuery Does Not Work With One Query indicated as MUST_NOT

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[jira] Created: (LUCENE-567) BooleanQuery Does Not Work With One Query indicated as MUST_NOT

JIRA jira@apache.org
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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (LUCENE-567) BooleanQuery Does Not Work With One Query indicated as MUST_NOT

JIRA jira@apache.org
    [ http://issues.apache.org/jira/browse/LUCENE-567?page=comments#action_12378820 ]

Otis Gospodnetic commented on LUCENE-567:
-----------------------------------------

That is by design.  Purely negative queries are not supported, which is why you had to add that MatchAllDocsQuery to get things to work.  Got a little patch for the Javadoc?

> 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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[jira] Closed: (LUCENE-567) BooleanQuery Does Not Work With One Query indicated as MUST_NOT

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org
     [ http://issues.apache.org/jira/browse/LUCENE-567?page=all ]
     
Otis Gospodnetic closed LUCENE-567:
-----------------------------------

    Resolution: Won't Fix

> 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: [hidden email]
For additional commands, e-mail: [hidden email]