全文检索同步最新的文档
This commit is contained in:
+7
-1
@@ -1684,7 +1684,7 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
|
||||
QueryWrapper<OSSFile> ossFile = new QueryWrapper<>();
|
||||
ossFile.eq("standard_id", id);
|
||||
ossFile.in("substring_index(file_name,'.',-1)", Arrays.asList(FILE_TYPE.split(",")));
|
||||
ossFile.orderByAsc(CREATE_TIME);
|
||||
ossFile.orderByDesc(CREATE_TIME);
|
||||
return oSSFileService.list(ossFile);
|
||||
}
|
||||
|
||||
@@ -1701,6 +1701,12 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
|
||||
private void updateES(String opType, LawsHomeNormalSearchVO obj, List<OSSFile> listFile, String id) {
|
||||
if (Objects.equals(opType, LawsHomeSearchCommon.LAWS_ES_ADD) ||
|
||||
Objects.equals(opType, LawsHomeSearchCommon.LAWS_ES_UPDATE)) {
|
||||
// 取最新的文件
|
||||
if(!CollectionUtils.isEmpty(listFile)){
|
||||
OSSFile file = listFile.get(0);
|
||||
listFile = new ArrayList<>();
|
||||
listFile.add(file);
|
||||
}
|
||||
updateElasticsearch(obj, listFile);
|
||||
} else if (Objects.equals(opType, LawsHomeSearchCommon.LAWS_ES_DELETE)) {
|
||||
jeroElasticsearchTemplate.delete(HomeSearchEnum.INDEX_NAME_DOCUMENT_ZQ.getValue(), HomeSearchEnum.TYPE_NAME_DOCUMENT_ZQ.getValue(), id);
|
||||
|
||||
Reference in New Issue
Block a user