|
|
package com.yoho.search.service.aggregations.impls;
|
|
|
|
|
|
import com.yoho.search.core.es.agg.AbstractAggregation;
|
|
|
|
|
|
import org.elasticsearch.search.aggregations.AbstractAggregationBuilder;
|
|
|
import org.elasticsearch.search.aggregations.Aggregation;
|
|
|
import org.elasticsearch.search.aggregations.AggregationBuilders;
|
...
|
...
|
@@ -21,7 +22,7 @@ public class IsNewAggregation extends AbstractAggregation { |
|
|
public AbstractAggregationBuilder getBuilder() {
|
|
|
return AggregationBuilders.terms(aggName()).field("isnew").size(2);
|
|
|
}
|
|
|
|
|
|
|
|
|
@Override
|
|
|
public Object getAggregationResponseMap(Map<String, Aggregation> aggMaps) {
|
|
|
MultiBucketsAggregation aggregation = this.getAggregation(aggMaps);
|
...
|
...
|
@@ -33,10 +34,10 @@ public class IsNewAggregation extends AbstractAggregation { |
|
|
Bucket bucket = itAgg.next();
|
|
|
String bool = bucket.getKeyAsString();
|
|
|
if ("Y".equals(bool)) {
|
|
|
return true;
|
|
|
return Boolean.TRUE;
|
|
|
}
|
|
|
}
|
|
|
return false;
|
|
|
return Boolean.FALSE;
|
|
|
}
|
|
|
|
|
|
} |
...
|
...
|
|