You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by "David Smiley (Jira)" <ji...@apache.org> on 2026/05/21 19:29:00 UTC

[jira] [Updated] (SOLR-18256) Auto-fix pure negative (NOT) clauses in the "lucene" QParser

     [ https://issues.apache.org/jira/browse/SOLR-18256?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

David Smiley updated SOLR-18256:
--------------------------------
    Description: 
When the lucene query parser parses a negative query — one where all boolean clauses are prohibited, such as {{NOT bar}}   , possibly as a sub-expression (parenthesis wrapped) — the resulting {{BooleanQuery}} matches no documents.  This is not what people intuitively expect.  I've seen code work around this, and it's really annoying.  I've also seen code _forget_ to do this, resulting in undesired behavior.  This has been a long-standing gotcha to stub your toe on with Solr development.

While it can be argued the fix should be in Lucene, I think Lucene is stubborn on this point, as there is _some_ sense in the current behavior.  I may pursue an opt-in improvement to BooleanQuery.Builder.

> Auto-fix pure negative (NOT) clauses in the "lucene" QParser
> ------------------------------------------------------------
>
>                 Key: SOLR-18256
>                 URL: https://issues.apache.org/jira/browse/SOLR-18256
>             Project: Solr
>          Issue Type: Improvement
>            Reporter: David Smiley
>            Priority: Major
>
> When the lucene query parser parses a negative query — one where all boolean clauses are prohibited, such as {{NOT bar}}   , possibly as a sub-expression (parenthesis wrapped) — the resulting {{BooleanQuery}} matches no documents.  This is not what people intuitively expect.  I've seen code work around this, and it's really annoying.  I've also seen code _forget_ to do this, resulting in undesired behavior.  This has been a long-standing gotcha to stub your toe on with Solr development.
> While it can be argued the fix should be in Lucene, I think Lucene is stubborn on this point, as there is _some_ sense in the current behavior.  I may pursue an opt-in improvement to BooleanQuery.Builder.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org