magibney commented on a change in pull request #158:
URL: https://github.com/apache/solr/pull/158#discussion_r644340081
##########
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:
Minor point, but I think it'd be fine to be less specific in the
"reason" arg to the MatchNoDocsQuery. Not to micro-optimize, but the
specificity is unlikely to _gain_ anything here practically speaking (right?).
(A cursory check for existing MatchNoDocsQuery constructor invocations in Solr
and Lucene shows that all seem to either invoke the no-arg ctor or pass in a
static String)
--
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:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]