mirror of https://github.com/apache/lucene.git
SOLR-9495: AIOBE with confusing message for incomplete sort spec in Streaming Expression
This commit is contained in:
parent
36a691c50d
commit
61676188d7
|
@ -332,6 +332,10 @@ public class CloudSolrStream extends TupleStream implements Expressible {
|
|||
|
||||
String[] spec = s.trim().split("\\s+"); //This should take into account spaces in the sort spec.
|
||||
|
||||
if (spec.length != 2) {
|
||||
throw new IOException("Invalid sort spec:" + s);
|
||||
}
|
||||
|
||||
String fieldName = spec[0].trim();
|
||||
String order = spec[1].trim();
|
||||
|
||||
|
|
|
@ -162,6 +162,16 @@ public class StreamExpressionTest extends SolrCloudTestCase {
|
|||
assertTrue(e.getMessage().contains("fl param expected for search function"));
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
expression = StreamExpressionParser.parse("search(" + COLLECTIONORALIAS + ", q=\"blah\", fl=\"id, a_f\", sort=\"a_f\")");
|
||||
stream = new CloudSolrStream(expression, factory);
|
||||
tuples = getTuples(stream);
|
||||
throw new Exception("Should be an exception here");
|
||||
} catch(Exception e) {
|
||||
assertTrue(e.getMessage().contains("Invalid sort spec"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Reference in New Issue