SOLR-12795: Require bucketSorts

This commit is contained in:
Joel Bernstein 2018-11-07 08:58:57 -05:00
parent 80efc23999
commit 259925d12f
2 changed files with 1 additions and 29 deletions

View File

@ -163,7 +163,7 @@ public class FacetStream extends TupleStream implements Expressible {
String bucketSortString = null;
if(bucketSortExpression == null) {
bucketSortString = "count(*) desc";
throw new IOException("The bucketSorts parameter is required for the facet function.");
} else {
bucketSortString = ((StreamExpressionValue)bucketSortExpression.getParameter()).getValue();
}

View File

@ -312,34 +312,6 @@ public class StreamExpressionToExpessionTest extends LuceneTestCase {
assertEquals(stream.getOffset(), 0);
}
try (FacetStream stream = new FacetStream(StreamExpressionParser.parse("facet("
+ "collection1, "
+ "q=\"*:*\", "
+ "buckets=\"a_s\", "
+ "bucketSizeLimit=100, "
+ "sum(a_i), sum(a_f), "
+ "min(a_i), min(a_f), "
+ "max(a_i), max(a_f), "
+ "avg(a_i), avg(a_f), "
+ "count(*)"
+ ")"), factory)){
expressionString = stream.toExpression(factory).toString();
assertTrue(expressionString.contains("facet(collection1"));
assertTrue(expressionString.contains("q=\"*:*\""));
assertTrue(expressionString.contains("buckets=a_s"));
assertTrue(expressionString.contains("bucketSorts=\"count(*) desc\""));
assertTrue(expressionString.contains("bucketSizeLimit=100"));
assertTrue(expressionString.contains("sum(a_i)"));
assertTrue(expressionString.contains("sum(a_f)"));
assertTrue(expressionString.contains("min(a_i)"));
assertTrue(expressionString.contains("min(a_f)"));
assertTrue(expressionString.contains("max(a_i)"));
assertTrue(expressionString.contains("max(a_f)"));
assertTrue(expressionString.contains("avg(a_i,false)"));
assertTrue(expressionString.contains("avg(a_f,false)"));
assertTrue(expressionString.contains("count(*)"));
}
try (FacetStream stream = new FacetStream(StreamExpressionParser.parse("facet("
+ "collection1, "
+ "q=\"*:*\", "