use of com.enonic.xp.aggregation.NumericRangeBucket in project xp by enonic.
the class AggregationMapper method serializeBucket.
private static void serializeBucket(final MapGenerator gen, final Bucket value) {
gen.map();
gen.value("key", value.getKey());
gen.value("docCount", value.getDocCount());
if (value instanceof DateRangeBucket) {
serializeDateBucket(gen, (DateRangeBucket) value);
} else if (value instanceof NumericRangeBucket) {
serializeNumericBucket(gen, (NumericRangeBucket) value);
}
final Aggregations subAggregations = value.getSubAggregations();
if (subAggregations != null) {
serializeAggregations(gen, subAggregations);
}
gen.end();
}
use of com.enonic.xp.aggregation.NumericRangeBucket in project xp by enonic.
the class AggregationMapper method serializeBucket.
private static void serializeBucket(final MapGenerator gen, final Bucket value) {
gen.map();
gen.value("key", value.getKey());
gen.value("docCount", value.getDocCount());
if (value instanceof DateRangeBucket) {
serializeDateBucket(gen, (DateRangeBucket) value);
} else if (value instanceof NumericRangeBucket) {
serializeNumericBucket(gen, (NumericRangeBucket) value);
}
final Aggregations subAggregations = value.getSubAggregations();
if (subAggregations != null) {
serializeAggregations(gen, subAggregations);
}
gen.end();
}
use of com.enonic.xp.aggregation.NumericRangeBucket in project xp by enonic.
the class NumericRangeAggregationTest method verifyBucket.
private void verifyBucket(final Bucket bucket, final int count, final String key) {
assertTrue(bucket instanceof NumericRangeBucket);
final NumericRangeBucket buck = (NumericRangeBucket) bucket;
assertEquals(count, buck.getDocCount());
if (!isNullOrEmpty(key)) {
assertEquals(buck.getKey(), key);
}
}
Aggregations