From 8df5807a0bbe5e8417fbd2e6ae3df57e777745f1 Mon Sep 17 00:00:00 2001 From: liyawei Date: Tue, 23 Aug 2022 18:28:16 +0800 Subject: [PATCH] =?UTF-8?q?=E6=90=9C=E7=B4=A2=E4=B8=AD=E5=BF=83-=E6=B3=95?= =?UTF-8?q?=E8=A7=84=E6=9C=88=E6=8A=A5-bug58587,58589?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../LawsMonthlyReportSearchServiceImpl.java | 21 ++++++------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/searchcenter/service/impl/LawsMonthlyReportSearchServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/searchcenter/service/impl/LawsMonthlyReportSearchServiceImpl.java index 55375d65b..a4d50bbd6 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/searchcenter/service/impl/LawsMonthlyReportSearchServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/searchcenter/service/impl/LawsMonthlyReportSearchServiceImpl.java @@ -64,12 +64,8 @@ public class LawsMonthlyReportSearchServiceImpl implements ILawsMonthlyReportSea String selectValueTwo = searchVO.getSelectValueTwo(); //1. 需要查询的字段 List fieldList = new ArrayList<>(); - fieldList.add("title");//权重5 - fieldList.add("file_text");//权重4 - fieldList.add("content");//权重3 - fieldList.add("file_name"); //权重2 - fieldList.add("module_type"); - fieldList.add("id"); + fieldList.add("title");//权重2 + fieldList.add("content");//权重1 fieldList.add("flag"); JSONArray queryMapJson = new JSONArray(); @@ -87,12 +83,8 @@ public class LawsMonthlyReportSearchServiceImpl implements ILawsMonthlyReportSea Map map4 = new HashMap<>(); if("title".equals(field)){ map3.put("boost",1); - }else if("file_text".equals(field)){ - map3.put("boost",0.01); }else if("content".equals(field)){ map3.put("boost",0.01); - }else if("file_name".equals(field)){ - map3.put("boost",1); } map3.put("query",selectValue); @@ -119,12 +111,8 @@ public class LawsMonthlyReportSearchServiceImpl implements ILawsMonthlyReportSea Map map3 = new HashMap<>(); if("title".equals(field)){ map3.put("boost",1); - }else if("file_text".equals(field)){ - map3.put("boost",0.01); }else if("content".equals(field)){ map3.put("boost",0.01); - }else if("file_name".equals(field)){ - map3.put("boost",1); } //特殊处理编号字段 @@ -190,8 +178,11 @@ public class LawsMonthlyReportSearchServiceImpl implements ILawsMonthlyReportSea } else { jsonObject = jeroElasticsearchTemplate.buildBoolQuery(queryMapJson, queryMustNot, null); } + JSONArray jsonArraySort = new JSONArray(); - jsonArraySort.add(querySort); + if (SEARCH_FLAG.equals(selectValue) && StringUtils.isEmpty(selectValueTwo)) { + jsonArraySort.add(querySort); + } //1. 条件,分页 JSONObject queryObject = jeroElasticsearchTemplate.buildQuery(null,