vonbox commented on a change in pull request #2118:
URL: https://github.com/apache/lucene-solr/pull/2118#discussion_r539142484
##########
File path: solr/core/src/java/org/apache/solr/search/FunctionQParser.java
##########
@@ -361,7 +361,9 @@ protected ValueSource parseValueSource(int flags) throws
SyntaxError {
((FunctionQParser)subParser).setParseMultipleSources(true);
}
Query subQuery = subParser.getQuery();
- if (subQuery instanceof FunctionQuery) {
+ if (subQuery == null) {
+ valueSource = new DoubleConstValueSource(0.0f);
+ } else if (subQuery instanceof FunctionQuery) {
valueSource = ((FunctionQuery) subQuery).getValueSource();
} else {
valueSource = new QueryValueSource(subQuery, 0.0f);
Review comment:
I think it would be good to catch problems at the gate, adding this
extra check. However, this could result in a risk that these exceptions pop up
in places that were (seemed) executing fine. Very small risk, if a
QueryValueSource with a null query is created a NPE is inevitable, so I cannot
imagine adding such check will cause new problems. Still, I did not dare to add
it yet. Can we get a veto of someone on this? (In the meantime I'll try it and
run the test suite.)
----------------------------------------------------------------
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]