diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/searchcenter/service/impl/DocumentSearchServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/searchcenter/service/impl/DocumentSearchServiceImpl.java index 47125c158..46dfc4de6 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/searchcenter/service/impl/DocumentSearchServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/searchcenter/service/impl/DocumentSearchServiceImpl.java @@ -1152,10 +1152,10 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService { 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_text".equals(field)){ + map3.put("boost",0.01); } //特殊处理标题字段 if (field.equals("title")){ @@ -1172,7 +1172,7 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService { //高亮 if(!"flag".equals(field)){ - highlight(mapHighlight, field); + problemKnowledgeBaseHighlight(mapHighlight, field); } } mapHighlight1.put("fields",mapHighlight); @@ -1219,7 +1219,7 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService { queryMapJsonTwo.add(queryMap); //高亮 if(!"flag".equals(field)){ - highlight(mapHighlight, field); + problemKnowledgeBaseHighlight(mapHighlight, field); } } mapHighlight1.put("fields",mapHighlight); @@ -1402,6 +1402,25 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService { } } + /** + * 问题知识库高亮设置 + * @param mapHighlight + * @param key + */ + private void problemKnowledgeBaseHighlight(Map mapHighlight, String key) { + Map mapTemp = new HashMap<>(); + List list = new ArrayList<>(); + list.add(""); + List list1 = new ArrayList<>(); + list1.add(""); + mapTemp.put("pre_tags", list); + mapTemp.put("post_tags", list1); + mapTemp.put("fragment_size", 2000);//高亮字段内容长度,去除html样式标签,统计字数,设置为200 + mapTemp.put("number_of_fragments", 1);//高亮内容默认分为5段, 此处设置为一段 + mapTemp.put("type", "plain"); + mapHighlight.put(key, mapTemp); + } + }