alessandrobenedetti commented on a change in pull request #158:
URL: https://github.com/apache/solr/pull/158#discussion_r644662049



##########
File path: solr/core/src/java/org/apache/solr/parser/SolrQueryParserBase.java
##########
@@ -1149,7 +1150,7 @@ protected Query getFieldQuery(String field, List<String> 
queryTerms, boolean raw
         return newFieldQuery
             (getAnalyzer(), field, queryText, false, 
fieldAutoGenPhraseQueries, fieldEnableGraphQueries, synonymQueryStyle);
       } else {
-        if (raw) {
+        if (raw) {// assumption: raw = false only when called from 
ExtendedDismaxQueryParser.getQuery()

Review comment:
       no strong opinion here, I thought it made more sense, on the side of the 
boolean variable it explains, I can revert if you think there are any benefit.
   N.B.  we are not swallowing the exception anymore, so I am not sure it has 
any sense there anymore

##########
File path: solr/core/src/java/org/apache/solr/parser/SolrQueryParserBase.java
##########
@@ -1159,8 +1160,11 @@ protected Query getFieldQuery(String field, List<String> 
queryTerms, boolean raw
             for (String queryTerm : queryTerms) {
               try {
                 subqs.add(ft.getFieldQuery(parser, sf, queryTerm));
-              } catch (Exception e) { // assumption: raw = false only when 
called from ExtendedDismaxQueryParser.getQuery()
-                // for edismax: ignore parsing failures
+              } catch (Exception e) {
+                // This happens when a field tries to parse a query term that 
has a type incompatible with the field
+                // e.g.
+                // a numerical field trying to parse a textual query term
+                subqs.add(new MatchNoDocsQuery(queryTerm + " is not compatible 
with " + field));

Review comment:
       ok, no strong opinion here, let me revert to empty constructor

##########
File path: solr/core/src/java/org/apache/solr/parser/SolrQueryParserBase.java
##########
@@ -1149,7 +1150,7 @@ protected Query getFieldQuery(String field, List<String> 
queryTerms, boolean raw
         return newFieldQuery
             (getAnalyzer(), field, queryText, false, 
fieldAutoGenPhraseQueries, fieldEnableGraphQueries, synonymQueryStyle);
       } else {
-        if (raw) {
+        if (raw) {// assumption: raw = false only when called from 
ExtendedDismaxQueryParser.getQuery()

Review comment:
       I see your point and I agree. Just reverted in the code!




-- 
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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



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

Reply via email to