mirror of https://github.com/apache/lucene.git
SOLR-12795: Require bucketSorts
This commit is contained in:
parent
80efc23999
commit
259925d12f
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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=\"*:*\", "
|
||||
|
|
Loading…
Reference in New Issue