From ffdc017db5581fea6a5def127849040b42617e72 Mon Sep 17 00:00:00 2001 From: liyawei Date: Wed, 24 Aug 2022 09:34:47 +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-bug58552,58591?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../LawsMonthlyReportSearchServiceImpl.java | 29 ++++++++++++++----- 1 file changed, 22 insertions(+), 7 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 a4d50bbd6..54c828580 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 @@ -86,10 +86,18 @@ public class LawsMonthlyReportSearchServiceImpl implements ILawsMonthlyReportSea }else if("content".equals(field)){ map3.put("boost",0.01); } + // 标题字段 通配符模糊匹配 + if (field.equals("title")){ + // map2放最内层 + map2.put(field, "*" + selectValue + "*"); - map3.put("query",selectValue); - map2.put(field, map3); - map4.put("match",map2); + // map4放query + map4.put("wildcard",map2); + } else { + map3.put("query", selectValue); + map2.put(field, map3); + map4.put("match", map2); + } queryMapJson.add(map4); //高亮 @@ -115,11 +123,18 @@ public class LawsMonthlyReportSearchServiceImpl implements ILawsMonthlyReportSea map3.put("boost",0.01); } - //特殊处理编号字段 - map3.put("query",selectValueTwo); + // 标题字段 通配符模糊匹配 + if (field.equals("title")){ + // map2放最内层 + map2.put(field, "*" + selectValueTwo + "*"); + // map4放query + queryMap.put("wildcard",map2); + } else { + map3.put("query", selectValueTwo); // map3.put("minimum_should_match",2); - map2.put(field, map3); - queryMap.put("match", map2); + map2.put(field, map3); + queryMap.put("match", map2); + } queryMapJsonTwo.add(queryMap); //高亮