Merge remote-tracking branch 'origin/dev_third_stage' into dev_third_stage

This commit is contained in:
liyawei
2022-08-24 17:06:56 +08:00
4 changed files with 51 additions and 20 deletions
@@ -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());
}
}
@@ -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);
}
}
@@ -769,7 +769,8 @@
}
.text-select {
flex: 1;
width: calc(100% - 126px);
height: 38px;
}
}
}
@@ -7,6 +7,7 @@
<span class="text-sel" :title="$t('problemClassification')">{{$t('problemClassification')}}</span>
<a-select :placeholder="$t('PleaseSelect')+$t('problemClassification')"
class="text-select"
:getPopupContainer="triggerNode=> triggerNode.parentNode"
allowClear
v-model="queryParamOne.problem_type">
<a-select-option v-for="(item, key) in tagList"
@@ -318,7 +319,7 @@
display: flex;
justify-content: space-between;
margin-bottom: 24px;
line-height: 32px;
line-height: 38px;
.text-sel {
font-size: 14px;
@@ -333,7 +334,7 @@
}
.text-select {
flex: 1;
width: calc(100% - 79px);
height: 38px;
}
}
@@ -499,9 +500,9 @@
padding: 0;
}
.selectText {
.selectText {
width: 100%;
display: inline-block;
display: inline-block;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;