mirror of https://github.com/apache/lucene.git
SOLR-11836: FacetStream works with bucketSizeLimit of -1 which will fetch all the buckets
This commit is contained in:
parent
398074d0f8
commit
d35d2063a8
|
@ -339,6 +339,9 @@ Bug Fixes
|
|||
|
||||
* SOLR-12733: SolrMetricReporterTest failure (Erick Erickson, David Smiley)
|
||||
|
||||
* SOLR-11836: FacetStream works with bucketSizeLimit of -1 which will fetch all the buckets.
|
||||
(Alfonso Muñoz-Pomer Fuentes via Varun Thacker)
|
||||
|
||||
Optimizations
|
||||
----------------------
|
||||
|
||||
|
|
|
@ -131,7 +131,7 @@ The `facet` function provides aggregations that are rolled up over buckets. Unde
|
|||
* `q`: (Mandatory) The query to build the aggregations from.
|
||||
* `buckets`: (Mandatory) Comma separated list of fields to rollup over. The comma separated list represents the dimensions in a multi-dimensional rollup.
|
||||
* `bucketSorts`: Comma separated list of sorts to apply to each dimension in the buckets parameters. Sorts can be on the computed metrics or on the bucket values.
|
||||
* `bucketSizeLimit`: The number of buckets to include. This value is applied to each dimension.
|
||||
* `bucketSizeLimit`: The number of buckets to include. This value is applied to each dimension. '-1' will fetch all the buckets.
|
||||
* `metrics`: List of metrics to compute for the buckets. Currently supported metrics are `sum(col)`, `avg(col)`, `min(col)`, `max(col)`, `count(*)`.
|
||||
|
||||
=== facet Syntax
|
||||
|
|
|
@ -161,8 +161,8 @@ public class FacetStream extends TupleStream implements Expressible {
|
|||
int limitInt = 0;
|
||||
try{
|
||||
limitInt = Integer.parseInt(limitStr);
|
||||
if(limitInt <= 0){
|
||||
throw new IOException(String.format(Locale.ROOT,"invalid expression %s - limit '%s' must be greater than 0.",expression, limitStr));
|
||||
if(limitInt <= 0 && limitInt != -1){
|
||||
throw new IOException(String.format(Locale.ROOT,"invalid expression %s - limit '%s' must be greater than 0 or -1.",expression, limitStr));
|
||||
}
|
||||
}
|
||||
catch(NumberFormatException e){
|
||||
|
@ -223,6 +223,9 @@ public class FacetStream extends TupleStream implements Expressible {
|
|||
this.buckets = buckets;
|
||||
this.metrics = metrics;
|
||||
this.bucketSizeLimit = bucketSizeLimit;
|
||||
if (this.bucketSizeLimit == -1) {
|
||||
this.bucketSizeLimit = Integer.MAX_VALUE;
|
||||
}
|
||||
this.collection = collection;
|
||||
this.bucketSorts = bucketSorts;
|
||||
|
||||
|
|
|
@ -1076,6 +1076,15 @@ public void testParallelRankStream() throws Exception {
|
|||
assertEquals(7.5, avgi.doubleValue(), 0.1);
|
||||
assertEquals(5.5, avgf.doubleValue(), 0.1);
|
||||
assertEquals(2, count.doubleValue(), 0.1);
|
||||
|
||||
sorts[0] = new FieldComparator("a_s", ComparatorOrder.ASCENDING);
|
||||
|
||||
facetStream = new FacetStream(zkHost, COLLECTIONORALIAS, sParamsA, buckets, metrics, sorts, -1);
|
||||
facetStream.setStreamContext(streamContext);
|
||||
tuples = getTuples(facetStream);
|
||||
|
||||
assertEquals(3, tuples.size());
|
||||
|
||||
} finally {
|
||||
solrClientCache.close();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue