文档库--首次搜索展示前后100字符
This commit is contained in:
+7
-5
@@ -449,12 +449,8 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
|
|||||||
if(!flagTemp){
|
if(!flagTemp){
|
||||||
return new Page(searchVO.getPage(), searchVO.getPageSize());
|
return new Page(searchVO.getPage(), searchVO.getPageSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
String selectValue = searchVO.getSelectValue();
|
String selectValue = searchVO.getSelectValue();
|
||||||
String selectValueTwo = searchVO.getSelectValueTwo();
|
String selectValueTwo = searchVO.getSelectValueTwo();
|
||||||
//测试数据
|
|
||||||
// selectValue = "看看";
|
|
||||||
// selectValueTwo = "喔喔";
|
|
||||||
//不查询高亮字段
|
//不查询高亮字段
|
||||||
//1. 需要查询的字段
|
//1. 需要查询的字段
|
||||||
List<String> fieldList = new ArrayList<>();
|
List<String> fieldList = new ArrayList<>();
|
||||||
@@ -465,7 +461,6 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
|
|||||||
fieldList.add("content");
|
fieldList.add("content");
|
||||||
fieldList.add("file_name");
|
fieldList.add("file_name");
|
||||||
fieldList.add("id");
|
fieldList.add("id");
|
||||||
|
|
||||||
JSONArray queryMapJson = new JSONArray();
|
JSONArray queryMapJson = new JSONArray();
|
||||||
if(StringUtils.isNotBlank(selectValue)){
|
if(StringUtils.isNotBlank(selectValue)){
|
||||||
for (String field : fieldList) {
|
for (String field : fieldList) {
|
||||||
@@ -611,6 +606,13 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
|
|||||||
value = "";
|
value = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if("content".equals(key)){
|
||||||
|
boolean flag = judgeContains(value, selectValue);
|
||||||
|
if(flag){
|
||||||
|
//截取第一处高亮的前后100个字符
|
||||||
|
value = getFileText(value, selectValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
for (int i = 0; i < value.length(); i++) {
|
for (int i = 0; i < value.length(); i++) {
|
||||||
String chStr = String.valueOf(value.charAt(i));
|
String chStr = String.valueOf(value.charAt(i));
|
||||||
if (selectValue.contains(String.valueOf(chStr))) {
|
if (selectValue.contains(String.valueOf(chStr))) {
|
||||||
|
|||||||
Reference in New Issue
Block a user