mirror of https://github.com/apache/lucene.git
SOLR-13203: return 400 on invalid dynamic field for edismax uf (#1502)
This commit is contained in:
parent
f96488180c
commit
291e358a3d
|
@ -221,6 +221,8 @@ Bug Fixes
|
|||
* SOLR-14467: Fix relatedness() stat in json.facets to no longer cause server errors (or nonsense results)
|
||||
when combined with allBuckets:true. (Michael Gibney, hossman)
|
||||
|
||||
* SOLR-13203: Return 400 status code on invalid dynamic field for Edismax's user Fields
|
||||
(Johannes Kloos, mrsoong via Munendra S N)
|
||||
|
||||
Other Changes
|
||||
---------------------
|
||||
|
|
|
@ -51,6 +51,7 @@ import org.apache.lucene.search.Query;
|
|||
import org.apache.lucene.search.spans.SpanQuery;
|
||||
import org.apache.solr.analysis.TokenizerChain;
|
||||
import org.apache.solr.common.SolrException;
|
||||
import org.apache.solr.common.SolrException.ErrorCode;
|
||||
import org.apache.solr.common.params.DisMaxParams;
|
||||
import org.apache.solr.common.params.SolrParams;
|
||||
import org.apache.solr.common.util.NamedList;
|
||||
|
@ -1609,7 +1610,7 @@ public class ExtendedDismaxQParser extends QParser {
|
|||
str=wildcard.substring(0,wildcard.length()-1);
|
||||
}
|
||||
else {
|
||||
throw new RuntimeException("dynamic field name must start or end with *");
|
||||
throw new SolrException(ErrorCode.BAD_REQUEST, "dynamic field name must start or end with *");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -709,6 +709,24 @@ public class TestExtendedDismaxParser extends SolrTestCaseJ4 {
|
|||
assertQ(req("defType","edismax", "q","Zapp Pig", "qf","myalias^100 name", "f.myalias.qf","trait_ss^0.1"), "//result/doc[1]/str[@name='id']=47", "//result/doc[2]/str[@name='id']=42");//Now the order should be inverse
|
||||
}
|
||||
|
||||
/** SOLR-13203 **/
|
||||
public void testUfDynamicField() throws Exception {
|
||||
try {
|
||||
ignoreException("dynamic field");
|
||||
|
||||
SolrException exception = expectThrows(SolrException.class,
|
||||
() -> h.query(req("uf", "fl=trait*,id", "defType", "edismax")));
|
||||
assertEquals(SolrException.ErrorCode.BAD_REQUEST.code, exception.code());
|
||||
assertEquals("dynamic field name must start or end with *",
|
||||
exception.getMessage());
|
||||
} finally {
|
||||
resetExceptionIgnores();
|
||||
}
|
||||
|
||||
// simple test to validate dynamic uf parsing works
|
||||
assertQ(req("uf", "trait* id", "defType", "edismax"));
|
||||
}
|
||||
|
||||
public void testCyclicAliasing() throws Exception {
|
||||
try {
|
||||
ignoreException(".*Field aliases lead to a cycle.*");
|
||||
|
|
Loading…
Reference in New Issue