Merge remote-tracking branch 'origin/dev_third_stage' into dev_third_stage
This commit is contained in:
+1
-1
@@ -380,7 +380,7 @@ public class ProblemKnowledgeBaseEOServiceImpl extends ServiceImpl<ProblemKnowle
|
||||
convertAfterMap.put("stand_number",problemKnowledgeBaseEO.getStandNumber());
|
||||
convertAfterMap.put("standard_title",problemKnowledgeBaseEO.getStandTitle());
|
||||
convertAfterMap.put("content",problemKnowledgeBaseEO.getContent());
|
||||
convertAfterMap.put("createTime",problemKnowledgeBaseEO.getCreateTime());
|
||||
convertAfterMap.put("create_time",new Date());
|
||||
convertAfterMap.put("show_permissions",problemKnowledgeBaseEO.getShowPermissions());
|
||||
}
|
||||
}
|
||||
|
||||
+43
-14
@@ -547,12 +547,20 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
|
||||
JSONObject jsonObjectThree = jeroElasticsearchTemplate.buildBoolQuery(null, null, queryMapJsonThree);
|
||||
queryMapJsonAll.add(jsonObjectThree);
|
||||
}
|
||||
// JSONObject sort = new JSONObject();
|
||||
// Map<String,Object> score = new HashMap<>();
|
||||
// Map<String,Object> score1 = new HashMap<>();
|
||||
// score.put("order","desc");
|
||||
// score1.put("_score",score);
|
||||
// sort.putAll(score1);
|
||||
JSONObject sort = new JSONObject();
|
||||
Map<String,Object> score = new HashMap<>();
|
||||
Map<String,Object> score1 = new HashMap<>();
|
||||
score.put("order","desc");
|
||||
score1.put("_score",score);
|
||||
sort.putAll(score1);
|
||||
if(StringUtils.isEmpty(selectValue)){
|
||||
Map<String,Object> createTime = new HashMap<>();
|
||||
Map<String,Object> createTime1 = new HashMap<>();
|
||||
createTime.put("order","desc");
|
||||
createTime1.put("create_time",createTime);
|
||||
sort.putAll(createTime1);
|
||||
}
|
||||
|
||||
// Map<String,Object> mapSort = new HashMap<>();
|
||||
// Map<String,Object> mapSortTemp = new HashMap<>();
|
||||
@@ -1152,10 +1160,10 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
|
||||
Map<String, Object> 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 +1180,7 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
|
||||
|
||||
//高亮
|
||||
if(!"flag".equals(field)){
|
||||
highlight(mapHighlight, field);
|
||||
problemKnowledgeBaseHighlight(mapHighlight, field);
|
||||
}
|
||||
}
|
||||
mapHighlight1.put("fields",mapHighlight);
|
||||
@@ -1219,7 +1227,7 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
|
||||
queryMapJsonTwo.add(queryMap);
|
||||
//高亮
|
||||
if(!"flag".equals(field)){
|
||||
highlight(mapHighlight, field);
|
||||
problemKnowledgeBaseHighlight(mapHighlight, field);
|
||||
}
|
||||
}
|
||||
mapHighlight1.put("fields",mapHighlight);
|
||||
@@ -1244,11 +1252,13 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
|
||||
queryMapJsonAll.add(jsonObjectThree);
|
||||
}
|
||||
JSONObject sort = new JSONObject();
|
||||
Map<String,Object> createTime = new HashMap<>();
|
||||
Map<String,Object> createTime1 = new HashMap<>();
|
||||
createTime.put("order","desc");
|
||||
createTime1.put("createTime",createTime);
|
||||
sort.putAll(createTime1);
|
||||
if(StringUtils.isEmpty(selectValue)){
|
||||
Map<String,Object> createTime = new HashMap<>();
|
||||
Map<String,Object> createTime1 = new HashMap<>();
|
||||
createTime.put("order","desc");
|
||||
createTime1.put("create_time",createTime);
|
||||
sort.putAll(createTime1);
|
||||
}
|
||||
|
||||
Integer pageNo = Integer.parseInt(map.get("pageNo").toString());
|
||||
Integer pageSize = Integer.parseInt(map.get("pageSize").toString());
|
||||
@@ -1402,6 +1412,25 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 问题知识库高亮设置
|
||||
* @param mapHighlight
|
||||
* @param key
|
||||
*/
|
||||
private void problemKnowledgeBaseHighlight(Map<String, Object> mapHighlight, String key) {
|
||||
Map<String, Object> mapTemp = new HashMap<>();
|
||||
List<String> list = new ArrayList<>();
|
||||
list.add("<text class='highlight-class'>");
|
||||
List<String> list1 = new ArrayList<>();
|
||||
list1.add("</text>");
|
||||
mapTemp.put("pre_tags", list);
|
||||
mapTemp.put("post_tags", list1);
|
||||
mapTemp.put("fragment_size", 550);//高亮字段内容长度,去除html样式标签,统计字数,设置为200
|
||||
mapTemp.put("number_of_fragments", 1);//高亮内容默认分为5段, 此处设置为一段
|
||||
mapTemp.put("type", "plain");
|
||||
mapHighlight.put(key, mapTemp);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user