提交 7f3569c8 作者: 925993793@qq.com

热词趋势分析返回的数据结构调整

上级 c1bb8d09
......@@ -2138,20 +2138,16 @@ public class EsService {
Terms groupSource = aggregations.get("groupKeyword");
List<? extends Terms.Bucket> buckets = groupSource.getBuckets();
for (Terms.Bucket bucket : buckets) {
CountVO countVO = new CountVO();
countVO.setName(bucket.getKeyAsString());
countVO.setValue(bucket.getDocCount());
List<CountVO> children = new ArrayList<>();
String keyword = bucket.getKeyAsString();
ParsedDateHistogram groupDate = bucket.getAggregations().get("groupDate");
List<? extends Histogram.Bucket> dateBuckets = groupDate.getBuckets();
for (Histogram.Bucket dateBucket : dateBuckets) {
CountVO child = new CountVO();
child.setName(dateBucket.getKeyAsString());
child.setValue(dateBucket.getDocCount());
children.add(child);
CountVO countVO = new CountVO();
countVO.setKey(keyword);
countVO.setName(dateBucket.getKeyAsString());
countVO.setValue(dateBucket.getDocCount());
list.add(countVO);
}
countVO.setChildren(children);
list.add(countVO);
}
} catch (Exception e) {
e.printStackTrace();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论