You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by "Chris M. Hostetter (Jira)" <ji...@apache.org> on 2026/08/03 18:32:00 UTC
[jira] [Commented] (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:comment-tabpanel&focusedCommentId=18101466#comment-18101466 ]
Chris M. Hostetter commented on SOLR-18256:
-------------------------------------------
{quote}My plan for the PR is to add {{setAutoFixPureNegative(boolean)}} to {{QParser}} and drive its default using {{{}luceneMatchVersion{}}}—does that sound good to everyone before I push the changes?
{quote}
I think that sounds great ... and FWIW: once you wrap up this jira, there are probably other QParsers that should probably start respecting that setting as well (ex: I think {{BoolQParserPlugin}} is also currently capable of producing pure-negative queries by default)
> 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
> Labels: newdev, pull-request-available
> Time Spent: 1h 20m
> Remaining Estimate: 0h
>
> 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