[ 
https://issues.apache.org/jira/browse/SOLR-3744?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15176543#comment-15176543
 ] 

Jack Krupansky commented on SOLR-3744:
--------------------------------------

Personally, I think the proper fix is in Lucene BooleanQuery itself - if no 
positive clauses are present, a MatchAllDocsQuery should be added as a MUST 
clause.

For example, currently if you have only one clause and it is MUST_NOT, BQ 
explicitly rewrites to MatchNoDocsQuery.

See:
https://github.com/apache/lucene-solr/blob/master/lucene/core/src/java/org/apache/lucene/search/BooleanQuery.java

Any objection from the core Lucene committers?

What does ES do when no positive clauses are present in a subquery?


> Solr LuceneQParser only handles pure negative queries at the top-level query, 
> but not within parenthesized sub-queries
> ----------------------------------------------------------------------------------------------------------------------
>
>                 Key: SOLR-3744
>                 URL: https://issues.apache.org/jira/browse/SOLR-3744
>             Project: Solr
>          Issue Type: Bug
>          Components: query parsers
>    Affects Versions: 3.6.1, 4.0-BETA
>            Reporter: Jack Krupansky
>
> The SolrQuerySyntax wiki says that pure negative queries are supported ("Pure 
> negative queries (all clauses prohibited) are allowed"), which is true at the 
> top-level query, but not for sub-queries enclosed within parentheses.
> See:
> http://wiki.apache.org/solr/SolrQuerySyntax
> Some queries that will not evaluate properly:
> test AND (-fox)
> test (-fox)
> test OR (abc OR (-fox))
> test (-fox)
> Sub-queries combined with the "AND" and "OR" keyword operators also fail to 
> evaluate properly. For example,
> test OR -fox
> -fox OR test
> Note that all of these queries are supported properly by the edismax query 
> parser.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to