Search in sources :

Example 1 with DateRangeBucket

use of com.enonic.xp.aggregation.DateRangeBucket 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();
}
Also used : Aggregations(com.enonic.xp.aggregation.Aggregations) DateRangeBucket(com.enonic.xp.aggregation.DateRangeBucket) NumericRangeBucket(com.enonic.xp.aggregation.NumericRangeBucket)

Example 2 with DateRangeBucket

use of com.enonic.xp.aggregation.DateRangeBucket 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();
}
Also used : Aggregations(com.enonic.xp.aggregation.Aggregations) DateRangeBucket(com.enonic.xp.aggregation.DateRangeBucket) NumericRangeBucket(com.enonic.xp.aggregation.NumericRangeBucket)

Example 3 with DateRangeBucket

use of com.enonic.xp.aggregation.DateRangeBucket in project xp by enonic.

the class DateRangeAggregationTest method verifyBucket.

private void verifyBucket(final Bucket bucket, final int count) {
    assertTrue(bucket instanceof DateRangeBucket);
    final DateRangeBucket buck = (DateRangeBucket) bucket;
    assertEquals(count, buck.getDocCount());
}
Also used : DateRangeBucket(com.enonic.xp.aggregation.DateRangeBucket)

Aggregations

DateRangeBucket (com.enonic.xp.aggregation.DateRangeBucket)3 Aggregations (com.enonic.xp.aggregation.Aggregations)2 NumericRangeBucket (com.enonic.xp.aggregation.NumericRangeBucket)2