Skip to content

Apache Lucene open-source search software

SOLR-11263: add test for payload func with undefined field

Munendra S N8322ea55f4f2
diff --git a/solr/core/src/test/org/apache/solr/search/function/TestFunctionQuery.java b/solr/core/src/test/org/apache/solr/search/function/TestFunctionQuery.java
index de10cee4828..499bb6eec2c 100644
--- a/solr/core/src/test/org/apache/solr/search/function/TestFunctionQuery.java
+++ b/solr/core/src/test/org/apache/solr/search/function/TestFunctionQuery.java
@@ -470,6 +470,10 @@ public class TestFunctionQuery extends SolrTestCaseJ4 {
);
// this should pass
assertQ(req("q", "*:*","defType","edismax", "boost","recip(1, 2, 3, 4)"));
+
+ // for undefined field NPE shouldn't be thrown
+ assertQEx("Should Fail as the field is undefined", "undefined field a",
+ req("q", "*:*", "fl", "x:payload(a,b)"), SolrException.ErrorCode.BAD_REQUEST);
}
@Test