Merge branch 'develop_migration' into 'develop_master'
feat: There is no way the, 优化ES See merge request LiuChao/foton-slrs-system-rest!469
This commit is contained in:
+36
-27
@@ -1413,30 +1413,30 @@ public class SearchCenterServiceImpl implements SearchCenterService {
|
||||
BoolQueryBuilder boolSelectValue = new BoolQueryBuilder();
|
||||
QueryBuilder multiQueryBuilder;
|
||||
String[] selects = null;
|
||||
if (StringUtils.isNotBlank(select)) {
|
||||
//判断标准号是否企标SMTC ,标准列别 (),/,字母
|
||||
Pattern pattern = Pattern.compile("^[a-zA-Z\\/\\(\\)\\(\\)]+$");
|
||||
if (pattern.matcher(value).matches()) {
|
||||
Pattern patternbianhao = Pattern.compile("^[0-9a-zA-Z\\.\\(\\(\\)\\)\\-\\s]+$");
|
||||
if (patternbianhao.matcher(select).matches()) {
|
||||
//符合标准编号
|
||||
selects = select.replace(" ","-").split("-");
|
||||
} else {
|
||||
//不符合标准编号 使用wildcard查询 编号
|
||||
selects = select.replace(" ","-").split("-");
|
||||
}
|
||||
} else {
|
||||
//不符合标准类别,wildcard 查询整体 real 6/23 解决搜索DRE的问题
|
||||
selects = null;
|
||||
value = real;
|
||||
// isReal = true;
|
||||
}
|
||||
}else{
|
||||
//没有空格,存在问题,使用wildcard查询 real
|
||||
selects = null;
|
||||
value = real;
|
||||
// isReal = true;
|
||||
}
|
||||
// if (StringUtils.isNotBlank(select)) {
|
||||
// //判断标准号是否企标SMTC ,标准列别 (),/,字母
|
||||
// Pattern pattern = Pattern.compile("^[a-zA-Z\\/\\(\\)\\(\\)]+$");
|
||||
// if (pattern.matcher(value).matches()) {
|
||||
// Pattern patternbianhao = Pattern.compile("^[0-9a-zA-Z\\.\\(\\(\\)\\)\\-\\s]+$");
|
||||
// if (patternbianhao.matcher(select).matches()) {
|
||||
// //符合标准编号
|
||||
// selects = select.replace(" ","-").split("-");
|
||||
// } else {
|
||||
// //不符合标准编号 使用wildcard查询 编号
|
||||
// selects = select.replace(" ","-").split("-");
|
||||
// }
|
||||
// } else {
|
||||
// //不符合标准类别,wildcard 查询整体 real 6/23 解决搜索DRE的问题
|
||||
// selects = null;
|
||||
// value = real;
|
||||
//// isReal = true;
|
||||
// }
|
||||
// }else{
|
||||
// //没有空格,存在问题,使用wildcard查询 real
|
||||
// selects = null;
|
||||
// value = real;
|
||||
//// isReal = true;
|
||||
// }
|
||||
|
||||
if (isReal){
|
||||
//查询real
|
||||
@@ -1444,9 +1444,13 @@ public class SearchCenterServiceImpl implements SearchCenterService {
|
||||
selects = null;
|
||||
}
|
||||
|
||||
if(null != value || null != selects){
|
||||
if (null != value && selects == null) {
|
||||
if(null != value || null != select){
|
||||
if (null != value && select == null) {
|
||||
boolSelectValue
|
||||
.should(QueryBuilders.wildcardQuery("sortTitle.keyword", "*" + value.toUpperCase() + "*").boost(1005f))
|
||||
.should(QueryBuilders.wildcardQuery("numberTitle.keyword", "*" + value.toUpperCase() + "*").boost(1003f))
|
||||
.should(QueryBuilders.wildcardQuery("yearOrder.keyword", "*" + value.toUpperCase() + "*").boost(1002f))
|
||||
.should(QueryBuilders.wildcardQuery("nameTitle.keyword", "*" + value.toUpperCase() + "*").boost(1001f))
|
||||
.should(QueryBuilders.wildcardQuery("title.keyword", "*" + value.toUpperCase() + "*").boost(1000f))
|
||||
.should(QueryBuilders.wildcardQuery("textContent.keyword", "*" + value.toUpperCase() + "*").boost(0.0000000000000000000000000000000001f))
|
||||
.should(QueryBuilders.wildcardQuery("issue_time", "*" + value.toUpperCase() + "*"));
|
||||
@@ -1456,8 +1460,12 @@ public class SearchCenterServiceImpl implements SearchCenterService {
|
||||
// boolQueryShould.should(multiQueryBuilder);
|
||||
}
|
||||
// searchInfoEO.setSelectValue(searchInfoEO.getSelectValue().replace("-","\\-"));
|
||||
if (null != selects) {
|
||||
if (null != select) {
|
||||
boolSelectValue
|
||||
.should(QueryBuilders.wildcardQuery("sortTitle.keyword", "*" + real.toUpperCase() + "*").boost(1005f))
|
||||
.should(QueryBuilders.wildcardQuery("numberTitle.keyword", "*" + real.toUpperCase() + "*").boost(1003f))
|
||||
.should(QueryBuilders.wildcardQuery("yearOrder.keyword", "*" + real.toUpperCase() + "*").boost(1002f))
|
||||
.should(QueryBuilders.wildcardQuery("nameTitle.keyword", "*" + real.toUpperCase() + "*").boost(1001f))
|
||||
.should(QueryBuilders.wildcardQuery("title.keyword", "*" + real.toUpperCase() + "*").boost(1000f))
|
||||
.should(QueryBuilders.wildcardQuery("textContent.keyword", "*" + real.toUpperCase() + "*").boost(0.0000000000000000000000000000000001f))
|
||||
.should(QueryBuilders.wildcardQuery("issue_time", "*" + real.toUpperCase() + "*"));
|
||||
@@ -1511,6 +1519,7 @@ public class SearchCenterServiceImpl implements SearchCenterService {
|
||||
searchRequestBuilder = client.prepareSearch("fulltextserch")
|
||||
.setSearchType(SearchType.DFS_QUERY_THEN_FETCH)
|
||||
.highlighter(hiBuilder)
|
||||
.addSort("issue_time_order",SortOrder.DESC)
|
||||
.setFrom((searchInfoEO.getPage()-1)*searchInfoEO.getPageSize())
|
||||
.setSize(searchInfoEO.getPageSize());
|
||||
|
||||
|
||||
@@ -75,6 +75,9 @@ public class ResetSearchCenterService {
|
||||
int count = iSarStandardsInfoService.count(qw);
|
||||
standSearch.setExecType(searchCenter.getExecType());
|
||||
standSearch.setCountStand(count);
|
||||
if(searchCenter.getIdList() != null && !searchCenter.getIdList().isEmpty()){
|
||||
standSearch.setIdList(searchCenter.getIdList());
|
||||
}
|
||||
SarStandardsInfoEOPage page = new SarStandardsInfoEOPage();
|
||||
ResponseMessage stand = resetStandSearchCenter(page,standSearch);
|
||||
List<String> r = new ArrayList<>();
|
||||
@@ -88,6 +91,9 @@ public class ResetSearchCenterService {
|
||||
int count2 = iSarLawsStandInfoService.count(qw2);
|
||||
lawsSearch.setExecType(searchCenter.getExecType());
|
||||
lawsSearch.setCountStand(count2);
|
||||
if(searchCenter.getIdList() != null && !searchCenter.getIdList().isEmpty()){
|
||||
lawsSearch.setIdList(searchCenter.getIdList());
|
||||
}
|
||||
SarLawsStandInfoPage lawsPage = new SarLawsStandInfoPage();
|
||||
ResponseMessage laws = resetLawsSearchCenter(lawsPage,lawsSearch);
|
||||
if(laws.isOk() && StringUtils.isNotBlank(laws.getData().toString())){
|
||||
@@ -100,6 +106,9 @@ public class ResetSearchCenterService {
|
||||
int count3 = iSarBussionessStandService.count(qw3);
|
||||
bussSearch.setExecType(searchCenter.getExecType());
|
||||
bussSearch.setCountStand(count3);
|
||||
if(searchCenter.getIdList() != null && !searchCenter.getIdList().isEmpty()){
|
||||
bussSearch.setIdList(searchCenter.getIdList());
|
||||
}
|
||||
SarBussionessStandEOPage bussPage = new SarBussionessStandEOPage();
|
||||
ResponseMessage buss = resetBussStandSearchCenter(bussPage,bussSearch);
|
||||
if(buss.isOk() && StringUtils.isNotBlank(buss.getData().toString())){
|
||||
@@ -200,14 +209,26 @@ public class ResetSearchCenterService {
|
||||
.filter(item -> !new ArrayList<>(esIdList)
|
||||
.contains(item.getId()))
|
||||
.collect(Collectors.toList());
|
||||
insList.addAll(distinctByUniqueList);
|
||||
if(searchCenter.getIdList() != null && !searchCenter.getIdList().isEmpty() && !distinctByUniqueList.isEmpty()){
|
||||
List<SarStandardsInfo> collect = distinctByUniqueList.stream()
|
||||
.filter(item -> searchCenter.getIdList().contains(item.getId())).collect(Collectors.toList());
|
||||
insList.addAll(collect);
|
||||
}else{
|
||||
insList.addAll(distinctByUniqueList);
|
||||
}
|
||||
|
||||
// 交集 更新
|
||||
List<SarStandardsInfo> intersection = rowsStand.stream()
|
||||
.filter(item -> new ArrayList<>(esIdList)
|
||||
.contains(item.getId()))
|
||||
.collect(Collectors.toList());
|
||||
updList.addAll(intersection);
|
||||
if(searchCenter.getIdList() != null && !searchCenter.getIdList().isEmpty() && !intersection.isEmpty()){
|
||||
List<SarStandardsInfo> collect = intersection.stream()
|
||||
.filter(item -> searchCenter.getIdList().contains(item.getId())).collect(Collectors.toList());
|
||||
updList.addAll(collect);
|
||||
}else{
|
||||
updList.addAll(intersection);
|
||||
}
|
||||
|
||||
// 差集 (list2 - list1) 删除
|
||||
List<String> delDataList = esIdList.stream().filter(num -> !standIdList.contains(num))
|
||||
@@ -287,14 +308,25 @@ public class ResetSearchCenterService {
|
||||
.filter(item -> !new ArrayList<>(esIdList)
|
||||
.contains(item.getId()))
|
||||
.collect(Collectors.toList());
|
||||
insList.addAll(distinctByUniqueList);
|
||||
|
||||
if(searchCenter.getIdList() != null && !searchCenter.getIdList().isEmpty() && !distinctByUniqueList.isEmpty()){
|
||||
List<SarLawsStandInfo> collect = distinctByUniqueList.stream()
|
||||
.filter(item -> searchCenter.getIdList().contains(item.getId())).collect(Collectors.toList());
|
||||
insList.addAll(collect);
|
||||
}else{
|
||||
insList.addAll(distinctByUniqueList);
|
||||
}
|
||||
// 交集 更新
|
||||
List<SarLawsStandInfo> intersection = rowsStand.stream()
|
||||
.filter(item -> new ArrayList<>(esIdList)
|
||||
.contains(item.getId()))
|
||||
.collect(Collectors.toList());
|
||||
updList.addAll(intersection);
|
||||
if(searchCenter.getIdList() != null && !searchCenter.getIdList().isEmpty() && !intersection.isEmpty()){
|
||||
List<SarLawsStandInfo> collect = intersection.stream()
|
||||
.filter(item -> searchCenter.getIdList().contains(item.getId())).collect(Collectors.toList());
|
||||
updList.addAll(collect);
|
||||
}else{
|
||||
updList.addAll(intersection);
|
||||
}
|
||||
|
||||
// 差集 (list2 - list1) 删除
|
||||
List<String> delDataList = esIdList.stream().filter(num -> !standIdList.contains(num))
|
||||
@@ -387,14 +419,26 @@ public class ResetSearchCenterService {
|
||||
.filter(item -> !new ArrayList<>(esIdList)
|
||||
.contains(item.getId()))
|
||||
.collect(Collectors.toList());
|
||||
insList.addAll(distinctByUniqueList);
|
||||
if(searchCenter.getIdList() != null && !searchCenter.getIdList().isEmpty() && !distinctByUniqueList.isEmpty()){
|
||||
List<SarBussionessStand> collect = distinctByUniqueList.stream()
|
||||
.filter(item -> searchCenter.getIdList().contains(item.getId())).collect(Collectors.toList());
|
||||
insList.addAll(collect);
|
||||
}else{
|
||||
insList.addAll(distinctByUniqueList);
|
||||
}
|
||||
|
||||
// 交集 更新
|
||||
List<SarBussionessStand> intersection = rowsStand.stream()
|
||||
.filter(item -> new ArrayList<>(esIdList)
|
||||
.contains(item.getId()))
|
||||
.collect(Collectors.toList());
|
||||
updList.addAll(intersection);
|
||||
if(searchCenter.getIdList() != null && !searchCenter.getIdList().isEmpty() && !intersection.isEmpty()){
|
||||
List<SarBussionessStand> collect = intersection.stream()
|
||||
.filter(item -> searchCenter.getIdList().contains(item.getId())).collect(Collectors.toList());
|
||||
updList.addAll(collect);
|
||||
}else{
|
||||
updList.addAll(intersection);
|
||||
}
|
||||
|
||||
// 差集 (list2 - list1) 删除
|
||||
List<String> delDataList = esIdList.stream().filter(num -> !standIdList.contains(num))
|
||||
|
||||
Reference in New Issue
Block a user