提交 2ee5f358 作者: 925993793@qq.com

自定义专题改版接口开发

上级 4b08e8ba
...@@ -536,4 +536,112 @@ public class InformationController { ...@@ -536,4 +536,112 @@ public class InformationController {
informationService.supplyByCondition(subjectId, JSONArray.parseArray(themeIds.toJSONString(), String.class)); informationService.supplyByCondition(subjectId, JSONArray.parseArray(themeIds.toJSONString(), String.class));
return Result.OK(); return Result.OK();
} }
/**
* 批量删除关键词
*
* @param searchCondition 检索条件
* @author lkg
* @date 2025/4/23
*/
@PostMapping("/removeWord")
public Result<?> removeWordLabel(@RequestBody InfoDataSearchCondition searchCondition) {
List<String> keywordList = searchCondition.getKeywordList();
if (CollectionUtils.isEmpty(keywordList)) {
return Result.FAIL("关键词不能为空");
}
CompletableFuture.runAsync(()-> informationService.removeWordLabel(searchCondition));
return Result.OK();
}
/**
* 批量添加到精选
*
* @param searchCondition 检索条件
* @author lkg
* @date 2025/4/23
*/
@PostMapping("/addToFavorites")
public Result<?> addToFavorites(@RequestBody InfoDataSearchCondition searchCondition) {
String subjectId = searchCondition.getSubjectId();
if (StringUtils.isEmpty(subjectId)) {
return Result.FAIL("专题id不能为空");
}
informationService.addToFavorites(searchCondition);
return Result.OK();
}
/**
* 批量添加到待定
*
* @param searchCondition 检索条件
* @author lkg
* @date 2025/4/23
*/
@PostMapping("/addToPend")
public Result<?> addToPend(@RequestBody InfoDataSearchCondition searchCondition) {
String subjectId = searchCondition.getSubjectId();
if (StringUtils.isEmpty(subjectId)) {
return Result.FAIL("专题id不能为空");
}
informationService.addToPend(searchCondition);
return Result.OK();
}
/**
* 批量添加到移除
*
* @param searchCondition 检索条件
* @author lkg
* @date 2025/4/23
*/
@PostMapping("/addToRemove")
public Result<?> addToRemove(@RequestBody InfoDataSearchCondition searchCondition) {
String subjectId = searchCondition.getSubjectId();
if (StringUtils.isEmpty(subjectId)) {
return Result.FAIL("专题id不能为空");
}
informationService.addToRemove(searchCondition);
return Result.OK();
}
/**
* 初始化数据
*
* @param searchCondition 检索条件
* @author lkg
* @date 2025/4/23
*/
@PostMapping("/initialData")
public Result<?> initialData(@RequestBody InfoDataSearchCondition searchCondition) {
String subjectId = searchCondition.getSubjectId();
if (StringUtils.isEmpty(subjectId)) {
return Result.FAIL("专题id不能为空");
}
informationService.initialData(searchCondition);
return Result.OK();
}
/**
* 字符串替换
*
* @param searchCondition 检索条件
* @author lkg
* @date 2025/4/23
*/
@PostMapping("/charReplace")
public Result<?> charReplace(@RequestBody InfoDataSearchCondition searchCondition) {
String subjectId = searchCondition.getSubjectId();
if (StringUtils.isEmpty(subjectId)) {
return Result.FAIL("专题id不能为空");
}
List<SearchWordVO> searchWordList = searchCondition.getSearchWordList();
if (CollectionUtils.isEmpty(searchWordList)) {
return Result.FAIL("检索词不能为空");
}
informationService.charReplace(searchCondition);
return Result.OK();
}
} }
...@@ -56,8 +56,7 @@ import org.elasticsearch.search.aggregations.metrics.Cardinality; ...@@ -56,8 +56,7 @@ import org.elasticsearch.search.aggregations.metrics.Cardinality;
import org.elasticsearch.search.builder.SearchSourceBuilder; import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.elasticsearch.search.collapse.CollapseBuilder; import org.elasticsearch.search.collapse.CollapseBuilder;
import org.elasticsearch.search.fetch.subphase.FetchSourceContext; import org.elasticsearch.search.fetch.subphase.FetchSourceContext;
import org.elasticsearch.search.sort.SortBuilders; import org.elasticsearch.search.sort.*;
import org.elasticsearch.search.sort.SortOrder;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -620,20 +619,20 @@ public class EsService { ...@@ -620,20 +619,20 @@ public class EsService {
if ("1".equals(eventDataCondition.getIsSubject())) { if ("1".equals(eventDataCondition.getIsSubject())) {
Subject byId = subjectService.getById(eventDataCondition.getSubjectId()); Subject byId = subjectService.getById(eventDataCondition.getSubjectId());
//更新开始、结束时间 //更新开始、结束时间
if(byId.getTimeEnable()!=null){ if (byId.getTimeEnable() != null) {
String timeEnable = DateUtil.format(byId.getTimeEnable(), "yyyy-MM-dd"); String timeEnable = DateUtil.format(byId.getTimeEnable(), "yyyy-MM-dd");
if(StringUtils.isEmpty(eventDataCondition.getStartTime()) || eventDataCondition.getStartTime().compareTo(timeEnable)<0){ if (StringUtils.isEmpty(eventDataCondition.getStartTime()) || eventDataCondition.getStartTime().compareTo(timeEnable) < 0) {
eventDataCondition.setStartTime(timeEnable); eventDataCondition.setStartTime(timeEnable);
} }
} }
if(byId.getTimeDisable()!=null){ if (byId.getTimeDisable() != null) {
String timeDisable = DateUtil.format(byId.getTimeDisable(), "yyyy-MM-dd"); String timeDisable = DateUtil.format(byId.getTimeDisable(), "yyyy-MM-dd");
if(StringUtils.isEmpty(eventDataCondition.getEndTime()) || eventDataCondition.getEndTime().compareTo(timeDisable)>0){ if (StringUtils.isEmpty(eventDataCondition.getEndTime()) || eventDataCondition.getEndTime().compareTo(timeDisable) > 0) {
eventDataCondition.setEndTime(timeDisable); eventDataCondition.setEndTime(timeDisable);
} }
} }
//以专题指定的索引为准 //以专题指定的索引为准
if(StringUtils.isNotEmpty(byId.getEsIndex())){ if (StringUtils.isNotEmpty(byId.getEsIndex())) {
index = byId.getEsIndex(); index = byId.getEsIndex();
} }
} }
...@@ -774,9 +773,7 @@ public class EsService { ...@@ -774,9 +773,7 @@ public class EsService {
* @date 2024/5/6 * @date 2024/5/6
*/ */
public IPage<SpecialInformation> pageListByCondition(InfoDataSearchCondition searchCondition, List<String> subjectIdList) throws IOException { public IPage<SpecialInformation> pageListByCondition(InfoDataSearchCondition searchCondition, List<String> subjectIdList) throws IOException {
String minDate = subjectService.getMinCreateTime(subjectIdList); String minDate = subjectService.getMinCreateTime(subjectIdList);
// Subject byId = subjectService(searchCondition.getSubjectId());
String[] indexs = EsIndexUtil.getIndexIntervalYearStr(Constants.SUBJECT_INDEX, minDate); String[] indexs = EsIndexUtil.getIndexIntervalYearStr(Constants.SUBJECT_INDEX, minDate);
SearchRequest searchRequest = new SearchRequest(indexs); SearchRequest searchRequest = new SearchRequest(indexs);
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder(); SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
...@@ -800,36 +797,62 @@ public class EsService { ...@@ -800,36 +797,62 @@ public class EsService {
if (searchCondition.getTopSortValid() == 1) { if (searchCondition.getTopSortValid() == 1) {
searchSourceBuilder.sort("topNum", SortOrder.DESC); searchSourceBuilder.sort("topNum", SortOrder.DESC);
} }
switch (column) { if (StringUtils.isEmpty(column)) {
case "score": searchSourceBuilder.sort("publishDate", SortOrder.DESC);
if (order.equals("asc")) { } else {
searchSourceBuilder.sort("score", SortOrder.ASC); SortOrder sortOrder = SortOrder.DESC;
searchSourceBuilder.sort("publishDate", SortOrder.ASC); if (order.equals("asc")) {
} else if (order.equals("desc")) { sortOrder = SortOrder.ASC;
searchSourceBuilder.sort("score", SortOrder.DESC); }
searchSourceBuilder.sort("publishDate", SortOrder.DESC); switch (column) {
} case "score":
break; searchSourceBuilder.sort("score", sortOrder);
case "publishDate": searchSourceBuilder.sort("publishDate", sortOrder);
if (order.equals("desc")) { break;
searchSourceBuilder.sort("publishDate", SortOrder.DESC); case "publishDate":
searchSourceBuilder.sort("publishDate", sortOrder);
searchSourceBuilder.sort("score", sortOrder);
break;
case "yqgzzk":
searchSourceBuilder.sort("dataFrom", SortOrder.DESC);
searchSourceBuilder.sort("topNum", SortOrder.DESC);
searchSourceBuilder.sort("score", SortOrder.DESC); searchSourceBuilder.sort("score", SortOrder.DESC);
} else if (order.equals("asc")) { break;
searchSourceBuilder.sort("publishDate", SortOrder.ASC); case "title":
searchSourceBuilder.sort("score", SortOrder.ASC); case "origin":
} searchSourceBuilder.sort(column + ".keyword", sortOrder);
break; break;
case "yqgzzk": case "summary":
searchSourceBuilder.sort("dataFrom", SortOrder.DESC); case "content":
searchSourceBuilder.sort("topNum", SortOrder.DESC); NestedSortBuilder nestedSortBuilder = new NestedSortBuilder("sortField");
searchSourceBuilder.sort("score", SortOrder.DESC); nestedSortBuilder.setFilter(QueryBuilders.termQuery("sortField.fieldType", column));
break; FieldSortBuilder fieldSortBuilder = SortBuilders.fieldSort("sortField.fieldKeyword")
default: .order(sortOrder)
searchSourceBuilder.sort("publishDate", SortOrder.DESC); .sortMode(SortMode.MAX)
break; .setNestedSort(nestedSortBuilder);
searchSourceBuilder.sort(fieldSortBuilder);
break;
case "labels":
NestedSortBuilder nestedLabelsSortBuilder = new NestedSortBuilder("labels");
FieldSortBuilder labelSortBuilder = SortBuilders.fieldSort("labels.relationId")
.order(sortOrder)
.sortMode(SortMode.MAX)
.setNestedSort(nestedLabelsSortBuilder);
searchSourceBuilder.sort(labelSortBuilder);
break;
default:
NestedSortBuilder nestedWordSortBuilder = new NestedSortBuilder("sortField");
nestedWordSortBuilder.setFilter(QueryBuilders.termQuery("sortField.fieldType", column));
FieldSortBuilder fieldWordSortBuilder = SortBuilders.fieldSort("sortField.fieldLong")
.order(sortOrder)
.sortMode(SortMode.MAX)
.setNestedSort(nestedWordSortBuilder);
searchSourceBuilder.sort(fieldWordSortBuilder);
break;
}
} }
//构建es查询条件 //构建es查询条件
BoolQueryBuilder boolQuery = null; BoolQueryBuilder boolQuery;
//判断ids字段是否为空,若不为空,则表示按照id勾选 //判断ids字段是否为空,若不为空,则表示按照id勾选
List<String> ids = searchCondition.getIds(); List<String> ids = searchCondition.getIds();
if (CollectionUtils.isNotEmpty(ids)) { if (CollectionUtils.isNotEmpty(ids)) {
...@@ -839,7 +862,7 @@ public class EsService { ...@@ -839,7 +862,7 @@ public class EsService {
if (CollectionUtils.isNotEmpty(sourceIdList)) { if (CollectionUtils.isNotEmpty(sourceIdList)) {
boolQuery.must(QueryBuilders.termsQuery("sid.keyword", sourceIdList)); boolQuery.must(QueryBuilders.termsQuery("sid.keyword", sourceIdList));
} }
}else { } else {
boolQuery = buildQuery(searchCondition, subjectIdList); boolQuery = buildQuery(searchCondition, subjectIdList);
} }
searchSourceBuilder.query(boolQuery); searchSourceBuilder.query(boolQuery);
...@@ -1975,14 +1998,14 @@ public class EsService { ...@@ -1975,14 +1998,14 @@ public class EsService {
* @author lkg * @author lkg
* @date 2024/12/25 * @date 2024/12/25
*/ */
private BoolQueryBuilder buildQuery(InfoDataSearchCondition searchCondition, List<String> subjectIdList) { public BoolQueryBuilder buildQuery(InfoDataSearchCondition searchCondition, List<String> subjectIdList) {
//创建查询对象 //创建查询对象
BoolQueryBuilder boolQuery = QueryBuilders.boolQuery(); BoolQueryBuilder boolQuery = QueryBuilders.boolQuery();
if (CollectionUtils.isNotEmpty(subjectIdList)) { if (CollectionUtils.isNotEmpty(subjectIdList)) {
Integer category = searchCondition.getCategory(); Integer category = searchCondition.getCategory();
boolQuery.must(QueryBuilders.termsQuery("subjectId.keyword", subjectIdList)); boolQuery.must(QueryBuilders.termsQuery("subjectId.keyword", subjectIdList));
//单个专题/事件,默认加上专题/事件的时间范围 //单个专题/事件,默认加上专题/事件的时间范围
if (subjectIdList.size() == 1) { /*if (subjectIdList.size() == 1) {
String configStartTime = null; String configStartTime = null;
String configEndTime = null; String configEndTime = null;
String id = subjectIdList.get(0); String id = subjectIdList.get(0);
...@@ -2020,7 +2043,7 @@ public class EsService { ...@@ -2020,7 +2043,7 @@ public class EsService {
} else { } else {
boolQuery.filter(QueryBuilders.rangeQuery("publishDate").lte(EsDateUtil.esFieldDateFormat(DateUtil.dateToString(new Date())))); boolQuery.filter(QueryBuilders.rangeQuery("publishDate").lte(EsDateUtil.esFieldDateFormat(DateUtil.dateToString(new Date()))));
} }
} }*/
} }
//高级查询数据处理 //高级查询数据处理
BoolQueryBuilder superQuery = buildSuperQuery(searchCondition.getSuperQueryMatchType(), searchCondition.getSuperQueryParams()); BoolQueryBuilder superQuery = buildSuperQuery(searchCondition.getSuperQueryMatchType(), searchCondition.getSuperQueryParams());
...@@ -2057,34 +2080,51 @@ public class EsService { ...@@ -2057,34 +2080,51 @@ public class EsService {
nestedBoolQueryBuilder.should(QueryBuilders.nestedQuery("labels", relationNameQuery, ScoreMode.None)); nestedBoolQueryBuilder.should(QueryBuilders.nestedQuery("labels", relationNameQuery, ScoreMode.None));
boolQuery.must(nestedBoolQueryBuilder); boolQuery.must(nestedBoolQueryBuilder);
} }
//资讯状态-研究中心(0-全部;1-模型推荐;2-精选;3-待定;4-移除),和checkStatus、deleteFlag、isFreeCheck互斥
Integer checkStatus = searchCondition.getCheckStatus(); Integer status = searchCondition.getStatus();
Integer deleteFlag = searchCondition.getDeleteFlag(); if (status != null) {
if (checkStatus != null) { if (status == 1) {
if (checkStatus == 0) { boolQuery.must(QueryBuilders.termQuery("checkStatus",0));
BoolQueryBuilder checkStatusBoolQuery = QueryBuilders.boolQuery(); boolQuery.must(QueryBuilders.termQuery("isFreeCheck", 1));
checkStatusBoolQuery.should(QueryBuilders.termQuery("checkStatus", checkStatus)); boolQuery.mustNot(QueryBuilders.termQuery("deleteFlag", 1));
checkStatusBoolQuery.should(QueryBuilders.boolQuery().mustNot(QueryBuilders.existsQuery("checkStatus"))); } else if (status == 2) {
boolQuery.must(checkStatusBoolQuery); boolQuery.must(QueryBuilders.termQuery("checkStatus", 1));
} else { boolQuery.mustNot(QueryBuilders.termQuery("deleteFlag", 1));
boolQuery.must(QueryBuilders.termQuery("checkStatus", checkStatus)); } else if (status == 3) {
boolQuery.must(QueryBuilders.termQuery("checkStatus", 3));
boolQuery.mustNot(QueryBuilders.termQuery("deleteFlag", 1));
} else if (status == 4) {
boolQuery.must(QueryBuilders.termQuery("deleteFlag", 1));
} }
} else { } else {
if (deleteFlag == null) { Integer checkStatus = searchCondition.getCheckStatus();
deleteFlag = 0; Integer deleteFlag = searchCondition.getDeleteFlag();
} if (checkStatus != null) {
} if (checkStatus == 0) {
//删除状态查询 BoolQueryBuilder checkStatusBoolQuery = QueryBuilders.boolQuery();
if (deleteFlag != null) { checkStatusBoolQuery.should(QueryBuilders.termQuery("checkStatus", checkStatus));
if (deleteFlag != 0) { checkStatusBoolQuery.should(QueryBuilders.boolQuery().mustNot(QueryBuilders.existsQuery("checkStatus")));
boolQuery.must(QueryBuilders.termQuery("deleteFlag", "1")); boolQuery.must(checkStatusBoolQuery);
} else {
boolQuery.must(QueryBuilders.termQuery("checkStatus", checkStatus));
}
} else { } else {
boolQuery.mustNot(QueryBuilders.termQuery("deleteFlag", "1")); if (deleteFlag == null) {
deleteFlag = 0;
}
}
//删除状态查询
if (deleteFlag != null) {
if (deleteFlag != 0) {
boolQuery.must(QueryBuilders.termQuery("deleteFlag", "1"));
} else {
boolQuery.mustNot(QueryBuilders.termQuery("deleteFlag", "1"));
}
}
//免审核状态
if (searchCondition.getIsFreeCheck() != null) {
boolQuery.must(QueryBuilders.termQuery("isFreeCheck", 1));
} }
}
//免审核状态
if (searchCondition.getIsFreeCheck() != null) {
boolQuery.must(QueryBuilders.termQuery("isFreeCheck", 1));
} }
if (StringUtils.isNotBlank(searchCondition.getVideo())) { if (StringUtils.isNotBlank(searchCondition.getVideo())) {
boolQuery.must(QueryBuilders.matchQuery("type", "video")); boolQuery.must(QueryBuilders.matchQuery("type", "video"));
...@@ -2129,7 +2169,7 @@ public class EsService { ...@@ -2129,7 +2169,7 @@ public class EsService {
for (String items : split) { for (String items : split) {
List<String> ids = Arrays.asList(items.split(",")); List<String> ids = Arrays.asList(items.split(","));
NestedQueryBuilder nestedQueryBuilder = QueryBuilders NestedQueryBuilder nestedQueryBuilder = QueryBuilders
.nestedQuery("labels", QueryBuilders.termsQuery("labels.relationId",ids), ScoreMode.None); .nestedQuery("labels", QueryBuilders.termsQuery("labels.relationId", ids), ScoreMode.None);
boolQuery.must(nestedQueryBuilder); boolQuery.must(nestedQueryBuilder);
} }
} }
...@@ -2175,6 +2215,11 @@ public class EsService { ...@@ -2175,6 +2215,11 @@ public class EsService {
if (StringUtils.isNotBlank(sourceId)) { if (StringUtils.isNotBlank(sourceId)) {
boolQuery.must(QueryBuilders.termQuery("sid.keyword", sourceId)); boolQuery.must(QueryBuilders.termQuery("sid.keyword", sourceId));
} }
//待删除的关键词列表
if (CollectionUtils.isNotEmpty(searchCondition.getKeywordList())) {
TermsQueryBuilder sortFieldQuery = QueryBuilders.termsQuery("sortField.fieldType", searchCondition.getKeywordList());
boolQuery.must(QueryBuilders.nestedQuery("sortField", sortFieldQuery, ScoreMode.None));
}
return boolQuery; return boolQuery;
} }
...@@ -2591,6 +2636,7 @@ public class EsService { ...@@ -2591,6 +2636,7 @@ public class EsService {
/** /**
* 根据id查询标签列表 * 根据id查询标签列表
*
* @param index * @param index
* @param id * @param id
* @return * @return
...@@ -2598,7 +2644,7 @@ public class EsService { ...@@ -2598,7 +2644,7 @@ public class EsService {
public List<Label> getLabelsById(String index, String id) { public List<Label> getLabelsById(String index, String id) {
try { try {
GetRequest request = new GetRequest(index, id); GetRequest request = new GetRequest(index, id);
request.fetchSourceContext(new FetchSourceContext(true, new String[]{"labels","title"}, null)); request.fetchSourceContext(new FetchSourceContext(true, new String[]{"labels", "title"}, null));
request.realtime(true); request.realtime(true);
GetResponse documentFields = client.get(request, RequestOptions.DEFAULT); GetResponse documentFields = client.get(request, RequestOptions.DEFAULT);
String labelsStr = JSONArray.toJSONString(documentFields.getSourceAsMap().get("labels")); String labelsStr = JSONArray.toJSONString(documentFields.getSourceAsMap().get("labels"));
...@@ -2611,6 +2657,7 @@ public class EsService { ...@@ -2611,6 +2657,7 @@ public class EsService {
/** /**
* 根据id更新标签列表 * 根据id更新标签列表
*
* @param index * @param index
* @param id * @param id
* @param labels * @param labels
...@@ -2618,6 +2665,6 @@ public class EsService { ...@@ -2618,6 +2665,6 @@ public class EsService {
public void updateLabelsById(String index, String id, List<Label> labels) { public void updateLabelsById(String index, String id, List<Label> labels) {
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
jsonObject.put("labels", labels); jsonObject.put("labels", labels);
esOpUtil.docUpdateById(index,id,jsonObject.toString()); esOpUtil.docUpdateById(index, id, jsonObject.toString());
} }
} }
...@@ -261,4 +261,58 @@ public interface InformationService { ...@@ -261,4 +261,58 @@ public interface InformationService {
List<SpecialInformation> informationAllList(InfoDataSearchCondition searchCondition); List<SpecialInformation> informationAllList(InfoDataSearchCondition searchCondition);
void removeLabelById(String index, String id, String relationId); void removeLabelById(String index, String id, String relationId);
/**
* 删除关键词标签
*
* @param searchCondition 检索条件
* @author lkg
* @date 2025/4/22
*/
void removeWordLabel(InfoDataSearchCondition searchCondition);
/**
* 批量添加到精选
*
* @param searchCondition 资讯检索条件
* @author lkg
* @date 2025/4/23
*/
void addToFavorites(InfoDataSearchCondition searchCondition);
/**
* 批量添加到精选
*
* @param searchCondition 资讯检索条件
* @author lkg
* @date 2025/4/23
*/
void addToPend(InfoDataSearchCondition searchCondition);
/**
* 批量添加到精选
*
* @param searchCondition 资讯检索条件
* @author lkg
* @date 2025/4/23
*/
void addToRemove(InfoDataSearchCondition searchCondition);
/**
* 初始化数据(数据状态全部重置为待审核、未删除)
*
* @param searchCondition 资讯检索条件
* @author lkg
* @date 2025/4/23
*/
void initialData(InfoDataSearchCondition searchCondition);
/**
* 字符串替换
*
* @param searchCondition 资讯检索条件
* @author lkg
* @date 2025/4/23
*/
void charReplace(InfoDataSearchCondition searchCondition);
} }
...@@ -30,6 +30,10 @@ import lombok.extern.slf4j.Slf4j; ...@@ -30,6 +30,10 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.lucene.search.join.ScoreMode;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.index.query.TermsQueryBuilder;
import org.jsoup.Jsoup; import org.jsoup.Jsoup;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -430,6 +434,7 @@ public class InformationServiceImpl implements InformationService { ...@@ -430,6 +434,7 @@ public class InformationServiceImpl implements InformationService {
labels.add(dataSet); labels.add(dataSet);
} }
} else { } else {
labels = new ArrayList<>();
labels.add(dataSet); labels.add(dataSet);
} }
information.setLabels(labels); information.setLabels(labels);
...@@ -659,9 +664,9 @@ public class InformationServiceImpl implements InformationService { ...@@ -659,9 +664,9 @@ public class InformationServiceImpl implements InformationService {
List<DictVO> boundList = dataBindLabelFrom.getBindList(); List<DictVO> boundList = dataBindLabelFrom.getBindList();
List<String> labelMarks = new ArrayList<>(); List<String> labelMarks = new ArrayList<>();
for (DictVO dictVO : boundList) { for (DictVO dictVO : boundList) {
if(StringUtils.isNotEmpty(dictVO.getCode())){ if (StringUtils.isNotEmpty(dictVO.getCode())) {
labelMarks.add(dictVO.getCode()); labelMarks.add(dictVO.getCode());
}else{ } else {
labelMarks.add(dictVO.getLabelMark()); labelMarks.add(dictVO.getLabelMark());
} }
} }
...@@ -675,7 +680,7 @@ public class InformationServiceImpl implements InformationService { ...@@ -675,7 +680,7 @@ public class InformationServiceImpl implements InformationService {
label.setRelationName(sysDictItem.getItemText()); label.setRelationName(sysDictItem.getItemText());
newLabels.add(label); newLabels.add(label);
} }
if (CollectionUtils.isNotEmpty(dbLabels)) { if (CollectionUtils.isNotEmpty(dbLabels)) {
List<Label> collect = dbLabels.stream().filter(label -> labelMarks.contains(label.getLabelMark())).collect(Collectors.toList()); List<Label> collect = dbLabels.stream().filter(label -> labelMarks.contains(label.getLabelMark())).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(collect)) { if (CollectionUtils.isNotEmpty(collect)) {
...@@ -1139,12 +1144,111 @@ public class InformationServiceImpl implements InformationService { ...@@ -1139,12 +1144,111 @@ public class InformationServiceImpl implements InformationService {
@Override @Override
public void removeLabelById(String index, String id, String relationId) { public void removeLabelById(String index, String id, String relationId) {
List<Label> labels = esService.getLabelsById(index,id); List<Label> labels = esService.getLabelsById(index, id);
if(labels == null){ if (labels == null) {
return; return;
} }
labels.removeIf(e -> e.getRelationId().equals(relationId)); labels.removeIf(e -> e.getRelationId().equals(relationId));
esService.updateLabelsById(index,id,labels); esService.updateLabelsById(index, id, labels);
}
@Override
public void removeWordLabel(InfoDataSearchCondition searchCondition) {
List<String> subjectIdList = new ArrayList<>();
subjectIdList.add(searchCondition.getSubjectId());
String minCreateTime = subjectService.getMinCreateTime(subjectIdList);
String[] indexArr = EsIndexUtil.getIndexIntervalYearStr(Constants.SUBJECT_INDEX, minCreateTime);
BoolQueryBuilder buildQuery = esService.buildQuery(searchCondition, subjectIdList);
buildQuery.must(QueryBuilders.nestedQuery("sortField",
QueryBuilders.termsQuery("sortField.fieldType", searchCondition.getKeywordList()),
ScoreMode.None));
List<String> keywordList = searchCondition.getKeywordList();
for (String word : keywordList) {
Map<String, Object> deleteParams = new HashMap<>();
deleteParams.put("fieldType", word);
esOpUtil.batchNestedDeleteScript(indexArr, buildQuery, deleteParams, "sortField");
}
}
@Override
public void addToFavorites(InfoDataSearchCondition searchCondition) {
List<String> subjectIdList = new ArrayList<>();
subjectIdList.add(searchCondition.getSubjectId());
String minCreateTime = subjectService.getMinCreateTime(subjectIdList);
String[] indexArr = EsIndexUtil.getIndexIntervalYearStr(Constants.SUBJECT_INDEX, minCreateTime);
BoolQueryBuilder buildQuery = esService.buildQuery(searchCondition, subjectIdList);
Map<String, Object> modifyParams = new HashMap<>();
modifyParams.put("checkStatus", 1);
modifyParams.put("deleteFlag",0);
esOpUtil.batchUpdateScript(indexArr, buildQuery, modifyParams);
}
@Override
public void addToPend(InfoDataSearchCondition searchCondition) {
List<String> subjectIdList = new ArrayList<>();
subjectIdList.add(searchCondition.getSubjectId());
String minCreateTime = subjectService.getMinCreateTime(subjectIdList);
String[] indexArr = EsIndexUtil.getIndexIntervalYearStr(Constants.SUBJECT_INDEX, minCreateTime);
BoolQueryBuilder buildQuery = esService.buildQuery(searchCondition, subjectIdList);
Map<String, Object> modifyParams = new HashMap<>();
modifyParams.put("checkStatus",3);
modifyParams.put("deleteFlag",0);
esOpUtil.batchUpdateScript(indexArr, buildQuery, modifyParams);
}
@Override
public void addToRemove(InfoDataSearchCondition searchCondition) {
List<String> subjectIdList = new ArrayList<>();
subjectIdList.add(searchCondition.getSubjectId());
String minCreateTime = subjectService.getMinCreateTime(subjectIdList);
String[] indexArr = EsIndexUtil.getIndexIntervalYearStr(Constants.SUBJECT_INDEX, minCreateTime);
BoolQueryBuilder buildQuery = esService.buildQuery(searchCondition, subjectIdList);
Map<String, Object> modifyParams = new HashMap<>();
modifyParams.put("deleteFlag",1);
esOpUtil.batchUpdateScript(indexArr, buildQuery, modifyParams);
}
@Override
public void initialData(InfoDataSearchCondition searchCondition) {
List<String> subjectIdList = new ArrayList<>();
subjectIdList.add(searchCondition.getSubjectId());
String minCreateTime = subjectService.getMinCreateTime(subjectIdList);
String[] indexArr = EsIndexUtil.getIndexIntervalYearStr(Constants.SUBJECT_INDEX, minCreateTime);
BoolQueryBuilder buildQuery = esService.buildQuery(searchCondition, subjectIdList);
Map<String, Object> modifyParams = new HashMap<>();
modifyParams.put("checkStatus",0);
modifyParams.put("deleteFlag",0);
esOpUtil.batchUpdateScript(indexArr, buildQuery, modifyParams);
}
@Override
public void charReplace(InfoDataSearchCondition searchCondition) {
SearchWordVO searchWordVO = searchCondition.getSearchWordList().get(0);
Integer searchScope = searchWordVO.getSearchScope();
String oldWord = searchWordVO.getSearchInfo();
String newWord = searchCondition.getReplaceWord();
if(StringUtils.isEmpty(newWord)) {
newWord = "";
}
List<String> modifyFields = new ArrayList<>();
if (searchScope == 1) {
modifyFields.add("title");
} else if (searchScope == 2) {
modifyFields.add("content");
modifyFields.add("contentWithTag");
} else if (searchScope == 3) {
modifyFields.add("title");
modifyFields.add("content");
modifyFields.add("contentWithTag");
} else if (searchScope == 4) {
modifyFields.add("origin");
}
List<String> subjectIdList = new ArrayList<>();
subjectIdList.add(searchCondition.getSubjectId());
String minCreateTime = subjectService.getMinCreateTime(subjectIdList);
String[] indexArr = EsIndexUtil.getIndexIntervalYearStr(Constants.SUBJECT_INDEX, minCreateTime);
BoolQueryBuilder buildQuery = esService.buildQuery(searchCondition, subjectIdList);
esOpUtil.batchReplaceScript(indexArr, buildQuery, modifyFields, oldWord, newWord);
} }
private void formatLabel(List<LabelModelVo> labelModelVos, DisplayInfo info) { private void formatLabel(List<LabelModelVo> labelModelVos, DisplayInfo info) {
......
...@@ -41,6 +41,7 @@ import org.elasticsearch.common.xcontent.XContentFactory; ...@@ -41,6 +41,7 @@ import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.index.query.*; import org.elasticsearch.index.query.*;
import org.elasticsearch.index.reindex.BulkByScrollResponse; import org.elasticsearch.index.reindex.BulkByScrollResponse;
import org.elasticsearch.index.reindex.BulkByScrollTask;
import org.elasticsearch.index.reindex.DeleteByQueryRequest; import org.elasticsearch.index.reindex.DeleteByQueryRequest;
import org.elasticsearch.index.reindex.UpdateByQueryRequest; import org.elasticsearch.index.reindex.UpdateByQueryRequest;
import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.RestStatus;
...@@ -60,9 +61,11 @@ import org.elasticsearch.search.sort.SortOrder; ...@@ -60,9 +61,11 @@ import org.elasticsearch.search.sort.SortOrder;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.validation.constraints.NotNull;
import java.io.IOException; import java.io.IOException;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
/** /**
* Es操作相关工具栏 * Es操作相关工具栏
...@@ -498,7 +501,7 @@ public class EsOpUtil<T> { ...@@ -498,7 +501,7 @@ public class EsOpUtil<T> {
} }
public void docUpdateBulk(String index, List<SpecialInformation> dataList){ public void docUpdateBulk(String index, List<SpecialInformation> dataList) {
BulkRequest bulkRequest = new BulkRequest(); BulkRequest bulkRequest = new BulkRequest();
for (SpecialInformation information : dataList) { for (SpecialInformation information : dataList) {
UpdateRequest request = new UpdateRequest(index, information.getId()); UpdateRequest request = new UpdateRequest(index, information.getId());
...@@ -534,9 +537,9 @@ public class EsOpUtil<T> { ...@@ -534,9 +537,9 @@ public class EsOpUtil<T> {
* @author lkg * @author lkg
* @date 2024/12/19 * @date 2024/12/19
*/ */
public void docRemoveBulk(List<Map<String, Object>> removeList){ public void docRemoveBulk(List<Map<String, Object>> removeList) {
BulkRequest bulkRequest = new BulkRequest(); BulkRequest bulkRequest = new BulkRequest();
for (Map<String,Object> m : removeList) { for (Map<String, Object> m : removeList) {
String index = m.get("index").toString(); String index = m.get("index").toString();
String id = m.get("id").toString(); String id = m.get("id").toString();
DeleteRequest deleteRequest = new DeleteRequest(index, id); DeleteRequest deleteRequest = new DeleteRequest(index, id);
...@@ -546,7 +549,7 @@ public class EsOpUtil<T> { ...@@ -546,7 +549,7 @@ public class EsOpUtil<T> {
try { try {
client.bulk(bulkRequest, RequestOptions.DEFAULT); client.bulk(bulkRequest, RequestOptions.DEFAULT);
} catch (Exception e) { } catch (Exception e) {
log.error("数据删除失败!",e); log.error("数据删除失败!", e);
} }
} }
...@@ -557,7 +560,7 @@ public class EsOpUtil<T> { ...@@ -557,7 +560,7 @@ public class EsOpUtil<T> {
* @author lkg * @author lkg
* @date 2024/12/19 * @date 2024/12/19
*/ */
public void docRemoveBulk(Map<String, List<SpecialInformation>> removeMap){ public void docRemoveBulk(Map<String, List<SpecialInformation>> removeMap) {
BulkRequest bulkRequest = new BulkRequest(); BulkRequest bulkRequest = new BulkRequest();
for (Map.Entry<String, List<SpecialInformation>> entry : removeMap.entrySet()) { for (Map.Entry<String, List<SpecialInformation>> entry : removeMap.entrySet()) {
String index = entry.getKey(); String index = entry.getKey();
...@@ -570,7 +573,7 @@ public class EsOpUtil<T> { ...@@ -570,7 +573,7 @@ public class EsOpUtil<T> {
try { try {
client.bulk(bulkRequest, RequestOptions.DEFAULT); client.bulk(bulkRequest, RequestOptions.DEFAULT);
} catch (Exception e) { } catch (Exception e) {
log.error("数据删除失败!",e); log.error("数据删除失败!", e);
} }
} }
...@@ -667,6 +670,8 @@ public class EsOpUtil<T> { ...@@ -667,6 +670,8 @@ public class EsOpUtil<T> {
} }
/** /**
* 批量更新(参数deleteParams 中的key要和es中的字段保持一致)
* <p>
* 批量更新操作,根据指定的查询条件和多个字段的映射关系,更新符合条件的文档的多个字段的值。 * 批量更新操作,根据指定的查询条件和多个字段的映射关系,更新符合条件的文档的多个字段的值。
* 方法名:updataMoreColumBatchByQuery,表示批量更新文档的多个字段的方法。 * 方法名:updataMoreColumBatchByQuery,表示批量更新文档的多个字段的方法。
* 参数:index,指定要更新的索引名称。 * 参数:index,指定要更新的索引名称。
...@@ -679,22 +684,138 @@ public class EsOpUtil<T> { ...@@ -679,22 +684,138 @@ public class EsOpUtil<T> {
* 设置更新脚本,使用setScript方法,传入Script对象。脚本使用painless语言,通过ctx._source.字段名 = 字段值的方式来更新文档的多个字段的值。 * 设置更新脚本,使用setScript方法,传入Script对象。脚本使用painless语言,通过ctx._source.字段名 = 字段值的方式来更新文档的多个字段的值。
* 调用client.updateByQuery方法,传入UpdateByQueryRequest对象和默认的RequestOptions,执行批量更新操作,并返回BulkByScrollResponse对象。 * 调用client.updateByQuery方法,传入UpdateByQueryRequest对象和默认的RequestOptions,执行批量更新操作,并返回BulkByScrollResponse对象。
* Collections.emptyMap()是setScript脚本的参数,此方法没有设置其他参数,使用一个空的map * Collections.emptyMap()是setScript脚本的参数,此方法没有设置其他参数,使用一个空的map
*
* @param index 索引
* @param boolQuery es查询条件
* @param modifyParams 更新参数
* @author lkg
* @date 2025/4/22
*/ */
public void updateMoreColumBatchByQuery(String index, BoolQueryBuilder boolQuery, Map<String, String> modifyColumValue) throws IOException, InterruptedException { public void batchUpdateScript(String[] index, BoolQueryBuilder boolQuery, Map<String, Object> modifyParams) {
UpdateByQueryRequest request = new UpdateByQueryRequest(index); UpdateByQueryRequest request = new UpdateByQueryRequest(index);
request.setQuery(boolQuery); request.setQuery(boolQuery);
request.setScript(new Script(ScriptType.INLINE, "painless", getIdOrCode(modifyColumValue), Collections.emptyMap())); StringBuffer script = new StringBuffer();
BulkByScrollResponse response = client.updateByQuery(request, RequestOptions.DEFAULT); modifyParams.forEach((colum, value) -> {
long updated = response.getUpdated(); if (value instanceof String) {
log.info("更新条数{}", updated); script.append("ctx._source.").append(colum).append(" = '").append(value).append("';");
} else {
script.append("ctx._source.").append(colum).append(" = ").append(value).append(";");
}
});
request.setScript(new Script(ScriptType.INLINE, "painless", script.toString(), Collections.emptyMap()));
//可跳过版本冲突的文档
request.setConflicts("proceed");
try {
BulkByScrollResponse response = client.updateByQuery(request, RequestOptions.DEFAULT);
long updated = response.getUpdated();
log.info("更新条数{}", updated);
} catch (IOException e) {
e.printStackTrace();
}
} }
private String getIdOrCode(Map<String, String> columValue) { /**
StringBuffer script = new StringBuffer(); * 批量替换字符串(更新的一种)
columValue.forEach((colum, value) -> { *
script.append("ctx._source.").append(colum).append(" = '").append(value).append("';"); * @param index 索引
* @param boolQuery es查询条件
* @param modifyField 编辑的字段集合
* @param oldValue 旧字符串
* @param newValue 新字符串
* @author lkg
* @date 2025/4/22
*/
public void batchReplaceScript(String[] index, BoolQueryBuilder boolQuery, List<String> modifyField, String oldValue, @NotNull String newValue) {
UpdateByQueryRequest request = new UpdateByQueryRequest(index);
request.setQuery(boolQuery);
String script = modifyField.stream()
.map(field -> String.format(
"if(ctx._source.%s != null) { ctx._source.%s = ctx._source.%s.replace('%s', '%s'); }",
field, field, field, oldValue, newValue))
.collect(Collectors.joining(""));
request.setScript(new Script(ScriptType.INLINE, "painless", script, Collections.emptyMap()));
//可跳过版本冲突的文档
request.setConflicts("proceed");
try {
BulkByScrollResponse response = client.updateByQuery(request, RequestOptions.DEFAULT);
long updated = response.getUpdated();
log.info("更新条数{}", updated);
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* 批量删除nest字段中的数据
* <p>
* 参数deleteParams 中的key要和es中的字段保持一致
*
* @param index 索引
* @param boolQuery es查询条件
* @param deleteParams 删除条件
* @param nestField nest字段
* @author lkg
* @date 2025/4/22
*/
public void batchNestedDeleteScript(String[] index, BoolQueryBuilder boolQuery, Map<String, Object> deleteParams, String nestField) {
UpdateByQueryRequest request = new UpdateByQueryRequest(index);
request.setQuery(boolQuery);
//Painless 脚本:从 nested 数组中删除匹配项
String scriptSource = "ctx._source." + nestField + ".removeIf(item -> ";
StringBuilder paramString = new StringBuilder();
deleteParams.forEach((colum, value) -> {
if (value instanceof String) {
paramString.append(" && ").append("item.").append(colum).append(" == params.").append(colum);
} else {
paramString.append(" && ").append("item.").append(colum).append(" == params.").append(colum);
}
}); });
return script.toString(); String substring = paramString.substring(4);
scriptSource = scriptSource + substring + ")";
Script script = new Script(ScriptType.INLINE, "painless", scriptSource, deleteParams);
request.setScript(script);
//可跳过版本冲突的文档
request.setConflicts("proceed");
try {
BulkByScrollResponse response = client.updateByQuery(request, RequestOptions.DEFAULT);
long deleted = response.getUpdated();
log.info("更新条数{}", deleted);
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* 批量新增nest字段中的数据
* <p>
* 参数addParams 中的key要和es中的字段保持一致
*
* @param index 索引
* @param boolQuery es查询条件
* @param addParams 添加的数据
* @param nestField nest字段
* @param uniqueField 唯一字段
* @author lkg
* @date 2025/4/22
*/
public void batchNestedAddScript(String[] index, BoolQueryBuilder boolQuery, Map<String, Object> addParams, String nestField, String uniqueField) {
UpdateByQueryRequest request = new UpdateByQueryRequest(index);
request.setQuery(boolQuery);
//Painless 脚本:从 nested 数组中删除匹配项
String scriptString = "if(ctx._source.NEST_FIELD==null){List ls=new ArrayList();ls.add(params.NEST_FIELD);ctx._source.NEST_FIELD=ls;}else{List olds=new ArrayList();ctx._source.NEST_FIELD.forEach(item->{olds.add(item.UNIQUE_FIELD);});if(!olds.contains(params.NEST_FIELD.UNIQUE_FIELD)){ctx._source.NEST_FIELD.add(params.NEST_FIELD);}}";
String scriptSource = scriptString.replace("NEST_FIELD", nestField).replace("UNIQUE_FIELD", uniqueField);
Script script = new Script(ScriptType.INLINE, "painless", scriptSource, addParams);
request.setScript(script);
//可跳过版本冲突的文档
request.setConflicts("proceed");
try {
BulkByScrollResponse response = client.updateByQuery(request, RequestOptions.DEFAULT);
long deleted = response.getUpdated();
log.info("更新条数{}", deleted);
} catch (IOException e) {
e.printStackTrace();
}
} }
...@@ -762,13 +883,13 @@ public class EsOpUtil<T> { ...@@ -762,13 +883,13 @@ public class EsOpUtil<T> {
} }
// 执行更新请求 // 执行更新请求
try { try {
UpdateResponse response = client.update(createUpdateRequest(index, id, args,true), RequestOptions.DEFAULT); UpdateResponse response = client.update(createUpdateRequest(index, id, args, true), RequestOptions.DEFAULT);
RestStatus status = response.status(); RestStatus status = response.status();
if (status.getStatus() != 200) { if (status.getStatus() != 200) {
log.info("{},更新失败",id); log.info("{},更新失败", id);
} }
} catch (IOException e) { } catch (IOException e) {
log.info("{},更新异常",id); log.info("{},更新异常", id);
} }
} }
...@@ -788,7 +909,7 @@ public class EsOpUtil<T> { ...@@ -788,7 +909,7 @@ public class EsOpUtil<T> {
BulkRequest bulkRequest = new BulkRequest(); BulkRequest bulkRequest = new BulkRequest();
args.forEach((id, args1) -> { args.forEach((id, args1) -> {
try { try {
bulkRequest.add(createUpdateRequest(index, id, args1,false)); bulkRequest.add(createUpdateRequest(index, id, args1, false));
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
...@@ -817,7 +938,7 @@ public class EsOpUtil<T> { ...@@ -817,7 +938,7 @@ public class EsOpUtil<T> {
* 将contentBuilder设置为更新请求的内容。 * 将contentBuilder设置为更新请求的内容。
* 返回更新请求UpdateRequest对象。 * 返回更新请求UpdateRequest对象。
*/ */
private UpdateRequest createUpdateRequest(String index, String documentId, Map<String, Object> args,Boolean refreshPolicy) throws IOException { private UpdateRequest createUpdateRequest(String index, String documentId, Map<String, Object> args, Boolean refreshPolicy) throws IOException {
UpdateRequest request = new UpdateRequest(index, documentId); UpdateRequest request = new UpdateRequest(index, documentId);
if (Boolean.TRUE.equals(refreshPolicy)) { if (Boolean.TRUE.equals(refreshPolicy)) {
//刷新策略,立即刷新 //刷新策略,立即刷新
......
...@@ -114,7 +114,7 @@ public class HanlpUtil { ...@@ -114,7 +114,7 @@ public class HanlpUtil {
* @创建时间 2020/8/27 19:56 * @创建时间 2020/8/27 19:56
* @Version 1.0 * @Version 1.0
*/ */
private static int countKeyWordInContent(String keyword, String srcContent){ public static int countKeyWordInContent(String keyword, String srcContent){
if(keyword==null ||keyword.trim().equals("")){ if(keyword==null ||keyword.trim().equals("")){
return 0; return 0;
} }
......
...@@ -50,11 +50,17 @@ public class InfoDataSearchCondition { ...@@ -50,11 +50,17 @@ public class InfoDataSearchCondition {
/**原创性(0-非原创;1-原创;2-疑似)*/ /**原创性(0-非原创;1-原创;2-疑似)*/
private String originality; private String originality;
//资讯状态-研究中心(0-全部;1-模型推荐;2-精选;3-待定;4-移除),和checkStatus、deleteFlag、isFreeCheck互斥
private Integer status;
//审核操作(0:未审核 1:审核通过 2:审核未通过 3:暂定 默认值为0) //审核操作(0:未审核 1:审核通过 2:审核未通过 3:暂定 默认值为0)
private Integer checkStatus; private Integer checkStatus;
//删除标记(1:删除;0:未删除) //删除标记(1:删除;0:未删除)
private Integer deleteFlag = 0; private Integer deleteFlag;
//是否免审核(1-是;0-否)
private Integer isFreeCheck;
//关联标签名称 //关联标签名称
private String labelName; private String labelName;
...@@ -104,15 +110,10 @@ public class InfoDataSearchCondition { ...@@ -104,15 +110,10 @@ public class InfoDataSearchCondition {
//待删除的标签id(多个用逗号隔开)-研究中心 //待删除的标签id(多个用逗号隔开)-研究中心
private String removeRelationId; private String removeRelationId;
//关键词信息;推荐信息源时使用-研究中心 //关键词信息;推荐信息源时使用-研究中心
private List<String> wordsList; private List<String> wordsList;
//是否免审核(1-是;0-否)
private Integer isFreeCheck;
//得分范围-研究中心 //得分范围-研究中心
//最小得分 //最小得分
private Integer minScore; private Integer minScore;
...@@ -126,7 +127,7 @@ public class InfoDataSearchCondition { ...@@ -126,7 +127,7 @@ public class InfoDataSearchCondition {
//排序参数 //排序参数
//排序字段 //排序字段
private String column = "publishDate"; private String column;
//排序方式 asc/desc //排序方式 asc/desc
private String order = "desc"; private String order = "desc";
//置顶排序是否起效(1-是;0-否) //置顶排序是否起效(1-是;0-否)
...@@ -166,7 +167,15 @@ public class InfoDataSearchCondition { ...@@ -166,7 +167,15 @@ public class InfoDataSearchCondition {
/*------添加至精选时,主题列表---start-------------------*/ /*------添加至精选时,主题列表---start-------------------*/
//聚合分组类型-按日期集合分析时使用
private List<Label> themeList; private List<Label> themeList;
/*------添加至精选时,主题列表---end-------------------*/ /*------添加至精选时,主题列表---end-------------------*/
/*------待删除的关键词列表---start-------------------*/
private List<String> keywordList;
/*------待删除的关键词列表---end-------------------*/
/*-----字符串替换---start-------------------*/
private String replaceWord;
/*------字符串替换---end-------------------*/
} }
...@@ -54,6 +54,8 @@ public class DisplayInfo { ...@@ -54,6 +54,8 @@ public class DisplayInfo {
private String type; private String type;
//标签信息 //标签信息
private List<Label> labels; private List<Label> labels;
//排序字段信息
private List<SortField> sortField;
//模型打分信息 //模型打分信息
private List<ModelScore> modelScores; private List<ModelScore> modelScores;
//视频下载链接 //视频下载链接
......
package com.zzsn.event.vo.es;
import lombok.Data;
/**
* 排序字段
*
* @author lkg
* @date 2025/4/22
*/
@Data
public class SortField {
//字段 (摘要、内容、标签、词频统计)
private String fieldType;
//字段排序值
private String fieldKeyword;
//词频
private Long fieldLong;
public SortField(String fieldType, Long fieldLong) {
this.fieldType = fieldType;
this.fieldLong = fieldLong;
}
public SortField(String fieldType, String fieldKeyword) {
this.fieldType = fieldType;
this.fieldKeyword = fieldKeyword;
}
}
...@@ -53,6 +53,8 @@ public class SpecialInformation { ...@@ -53,6 +53,8 @@ public class SpecialInformation {
private String type; private String type;
//标签信息 //标签信息
private List<Label> labels; private List<Label> labels;
//排序字段信息
private List<SortField> sortField;
//模型打分信息 //模型打分信息
private List<ModelScore> modelScores; private List<ModelScore> modelScores;
//视频下载链接 //视频下载链接
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论