dsmiley commented on code in PR #4552:
URL: https://github.com/apache/solr/pull/4552#discussion_r3733832449


##########
solr/core/src/java/org/apache/solr/search/QParser.java:
##########
@@ -107,6 +108,16 @@ public QParser(String qstr, SolrParams localParams, 
SolrParams params, SolrQuery
 
     this.params = Objects.requireNonNull(params);
     this.req = req;
+
+    if (req != null && req.getCore() != null && req.getCore().getSolrConfig() 
!= null) {

Review Comment:
   As you are being extremely cautious to check for a request and a core (maybe 
null when mocking?), let's ensure that if that happens we do 
autoFixPureNegative as a default.  It's only when the version is both found and 
is old that we don't want to auto-fix.



##########
solr/core/src/java/org/apache/solr/search/SolrQueryParser.java:
##########
@@ -24,4 +27,13 @@ public class SolrQueryParser extends QueryParser {
   public SolrQueryParser(QParser parser, String defaultField) {
     super(defaultField, parser);
   }
+
+  @Override
+  protected Query getBooleanQuery(List<BooleanClause> clauses) throws 
SyntaxError {
+    Query q = super.getBooleanQuery(clauses);
+    if (parser != null && parser.isAutoFixPureNegative()) {

Review Comment:
   again you are being super careful... will parser really actually be null?  
If Solr's massive test suite doesn't fail then don't check for null.  But if it 
does then I think we want the default to auto-fix.



##########
changelog/unreleased/SOLR_18256_autofix_negative_lucene_clauses.yml:
##########
@@ -0,0 +1,8 @@
+type: fixed
+title: Fix pure negative (NOT) sub-expression queries in lucene QParser

Review Comment:
   ```suggestion
   title: Pure negative (NOT) expressions in the "lucene" (default) QParser no 
longer need an explicit *:* to work.
   type: fixed
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to