use of com.topcom.cms.es.vo.KV in project topcom-cloud by 545314690.
the class WarningLogManagerImpl method getWarningInfo.
@Override
public Page getWarningInfo(WarningLog warningLog, int pageNum, int limit) {
if (warningLog == null) {
return new PageImpl<>(new ArrayList<>());
}
BoolQueryRequest request = new BoolQueryRequest();
request.setType(null);
request.setFiled(warningLog.getField());
request.setKeyword(new Keyword(warningLog.getMustWord(), warningLog.getShouldWord(), warningLog.getMustNotWord()));
/**
* 数据发布时间:暂定三天内
*/
// TODO:三天内合适不?
// Date now = new Date();
// request.setDate(new DateParam(DateUtil.dateToString(DateUtils.addDays(now, -3)), DateUtil.dateToString(now)));
/**
* 数据保存时间
*/
request.setDateCreated(new DateParam(warningLog.getStartDate(), warningLog.getEndDate()));
Date now = request.getDateCreated().endDate();
request.setDate(new DateParam(DateUtil.dateToString(DateUtils.addDays(now, -3)), DateUtil.dateToString(now)));
request.setPage(new PageRequest(pageNum, limit, new Order(Sort.Direction.DESC, "pubTime")));
List<KV> kvList = new ArrayList<>();
// 媒体类型
String[] type = warningLog.getType();
if (type != null && type.length > 0) {
request.setType(type);
}
String[] sentimentLabel = warningLog.getSentimentLabel();
// 情感类型
if (sentimentLabel != null && sentimentLabel.length > 0) {
kvList.add(new KV("nlp.sentiment.label", sentimentLabel));
}
request.setSearchKv(kvList);
final Page page = newsService.findByMustShouldDateInType(request);
return page;
}
Aggregations