You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Tom Marsh (Created) (JIRA)" <ji...@apache.org> on 2012/04/04 20:39:23 UTC

[jira] [Created] (SOLR-3315) SOLR ignores 'NOT' clause in query

SOLR ignores 'NOT' clause in query
----------------------------------

                 Key: SOLR-3315
                 URL: https://issues.apache.org/jira/browse/SOLR-3315
             Project: Solr
          Issue Type: Bug
          Components: search
    Affects Versions: 3.5
         Environment: Windows, Java 7
            Reporter: Tom Marsh
            Priority: Critical


We have a simple domain where

FirstName_s:"Bob"
returns 40 documents, and

-Department_t:"Ninjas"
returns all of the documents (we don't have a ninja department).

We expected the query

(FirstName_s:"Bob") OR (-Department_t:"Ninjas")
to return all documents, however it only returned the original 40 documents.

We have experimented with a couple of different orderings, tried using 'NOT' instead of '-' all to no avail.

Is this expected behavior? Perhaps more importantly, how do we get the behavior we expect?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] [Resolved] (SOLR-3315) SOLR ignores 'NOT' clause in query

Posted by "Hoss Man (Resolved) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SOLR-3315?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Hoss Man resolved SOLR-3315.
----------------------------

    Resolution: Not A Problem

this appears to be a missunderstanding about how the query parser works.

using parens creates a boolean query, and a boolean query containing only negative clauses does not match anything by definition.  

any of the following should work equivalent what you are describing (returning all documents, scoring documents with first name "bob" higher)...

{noformat}
firstname:bob -department:ninja
firstname:bob NOT department_t:ninja
firstname:bob OR (*:* -department:ninja)
{noformat}

if you have additional questions, please ask them on the solr-user@lucene mailing list, not in Jira.
                
> SOLR ignores 'NOT' clause in query
> ----------------------------------
>
>                 Key: SOLR-3315
>                 URL: https://issues.apache.org/jira/browse/SOLR-3315
>             Project: Solr
>          Issue Type: Bug
>          Components: search
>    Affects Versions: 3.5
>         Environment: Windows, Java 7
>            Reporter: Tom Marsh
>            Priority: Critical
>              Labels: not, query
>
> We have a simple domain where
> FirstName_s:"Bob"
> returns 40 documents, and
> -Department_t:"Ninjas"
> returns all of the documents (we don't have a ninja department).
> We expected the query
> (FirstName_s:"Bob") OR (-Department_t:"Ninjas")
> to return all documents, however it only returned the original 40 documents.
> We have experimented with a couple of different orderings, tried using 'NOT' instead of '-' all to no avail.
> Is this expected behavior? Perhaps more importantly, how do we get the behavior we expect?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] [Commented] (SOLR-3315) SOLR ignores 'NOT' clause in query

Posted by "Tom Marsh (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-3315?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13246603#comment-13246603 ] 

Tom Marsh commented on SOLR-3315:
---------------------------------

Further investigation has shown that inverting the rule with de Morgans: -(-FirstName_s:"Bob" AND Department_t:"Ninjas") does give us the result we expected. However, I believe this points to this being a parsing bug.
                
> SOLR ignores 'NOT' clause in query
> ----------------------------------
>
>                 Key: SOLR-3315
>                 URL: https://issues.apache.org/jira/browse/SOLR-3315
>             Project: Solr
>          Issue Type: Bug
>          Components: search
>    Affects Versions: 3.5
>         Environment: Windows, Java 7
>            Reporter: Tom Marsh
>            Priority: Critical
>              Labels: not, query
>
> We have a simple domain where
> FirstName_s:"Bob"
> returns 40 documents, and
> -Department_t:"Ninjas"
> returns all of the documents (we don't have a ninja department).
> We expected the query
> (FirstName_s:"Bob") OR (-Department_t:"Ninjas")
> to return all documents, however it only returned the original 40 documents.
> We have experimented with a couple of different orderings, tried using 'NOT' instead of '-' all to no avail.
> Is this expected behavior? Perhaps more importantly, how do we get the behavior we expect?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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