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