搜索中心
This commit is contained in:
+70
-31
@@ -787,42 +787,23 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
|
|||||||
list.add(group);
|
list.add(group);
|
||||||
}
|
}
|
||||||
for (String s : list) {
|
for (String s : list) {
|
||||||
Map<String, Object> map33 = new HashMap<>();
|
|
||||||
if("serial_number".equals(field)){
|
|
||||||
map33.put("boost",10);
|
|
||||||
}else if("title".equals(field)){
|
|
||||||
map33.put("boost",8);
|
|
||||||
}else if("file_text".equals(field)){
|
|
||||||
map33.put("boost",0.01);
|
|
||||||
}else if("content".equals(field)){
|
|
||||||
map33.put("boost",0.01);
|
|
||||||
}else if("file_name".equals(field)){
|
|
||||||
map33.put("boost",5);
|
|
||||||
}
|
|
||||||
map33.put("query",s);
|
|
||||||
Map<String,Object> map1 = new HashMap<>();
|
|
||||||
map1.put(field,map33);
|
|
||||||
Map<String,Object> map2 = new HashMap<>();
|
|
||||||
map2.put("match",map1);
|
|
||||||
queryMapJson.add(map2);
|
|
||||||
|
|
||||||
// // wildcard模糊查询
|
// // wildcard模糊查询
|
||||||
// //情况举例:用户只记得中间那段字
|
// //情况举例:用户只记得中间那段字
|
||||||
Map<String, Object> map24 = new HashMap<>();
|
Map<String, Object> map24 = new HashMap<>();
|
||||||
Map<String, Object> map44 = new HashMap<>();
|
Map<String, Object> map44 = new HashMap<>();
|
||||||
Map<String, Object> map55 = new HashMap<>();
|
Map<String, Object> map55 = new HashMap<>();
|
||||||
map55.put("value","*" + selectValue + "*");
|
map55.put("value","*" + s + "*");
|
||||||
// if("serial_number".equals(field)){
|
if("serial_number".equals(field)){
|
||||||
// map55.put("boost",10);
|
map55.put("boost",10);
|
||||||
// }else if("title".equals(field)){
|
}else if("title".equals(field)){
|
||||||
// map55.put("boost",8);
|
map55.put("boost",8);
|
||||||
// }else if("file_text".equals(field)){
|
}else if("file_text".equals(field)){
|
||||||
// map55.put("boost",0.01);
|
map55.put("boost",0.01);
|
||||||
// }else if("content".equals(field)){
|
}else if("content".equals(field)){
|
||||||
// map55.put("boost",0.01);
|
map55.put("boost",0.01);
|
||||||
// }else if("file_name".equals(field)){
|
}else if("file_name".equals(field)){
|
||||||
// map55.put("boost",5);
|
map55.put("boost",5);
|
||||||
// }
|
}
|
||||||
|
|
||||||
map24.put(field, map55);
|
map24.put(field, map55);
|
||||||
map44.put("wildcard",map24);
|
map44.put("wildcard",map24);
|
||||||
@@ -830,6 +811,64 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// private void getQueryMapJsonFullText(JSONArray queryMapJson, String selectValue, String field) {
|
// private void getQueryMapJsonFullText(JSONArray queryMapJson, String selectValue, String field) {
|
||||||
|
// // match分词匹配查询
|
||||||
|
// // 情况举例:用户可能他知道开头的前缀几个字,知道中间的几个字
|
||||||
|
// //依据正则拆分示例:你好Hello123世界World456可拆分为:你好、Hello、123、世界、World、456
|
||||||
|
//
|
||||||
|
// String regex = "([\\u4e00-\\u9fa5]+|[a-zA-Z]+|\\d+)";
|
||||||
|
// Pattern pattern = Pattern.compile(regex);
|
||||||
|
// Matcher matcher = pattern.matcher(selectValue);
|
||||||
|
//
|
||||||
|
// List<String> list = new ArrayList<>();
|
||||||
|
// list.add(selectValue);
|
||||||
|
// while (matcher.find()) {
|
||||||
|
// String group = matcher.group();
|
||||||
|
// list.add(group);
|
||||||
|
// }
|
||||||
|
// for (String s : list) {
|
||||||
|
// Map<String, Object> map33 = new HashMap<>();
|
||||||
|
// if("serial_number".equals(field)){
|
||||||
|
// map33.put("boost",10);
|
||||||
|
// }else if("title".equals(field)){
|
||||||
|
// map33.put("boost",8);
|
||||||
|
// }else if("file_text".equals(field)){
|
||||||
|
// map33.put("boost",0.01);
|
||||||
|
// }else if("content".equals(field)){
|
||||||
|
// map33.put("boost",0.01);
|
||||||
|
// }else if("file_name".equals(field)){
|
||||||
|
// map33.put("boost",5);
|
||||||
|
// }
|
||||||
|
// map33.put("query",s);
|
||||||
|
// Map<String,Object> map1 = new HashMap<>();
|
||||||
|
// map1.put(field,map33);
|
||||||
|
// Map<String,Object> map2 = new HashMap<>();
|
||||||
|
// map2.put("match",map1);
|
||||||
|
// queryMapJson.add(map2);
|
||||||
|
//
|
||||||
|
// // // wildcard模糊查询
|
||||||
|
//// //情况举例:用户只记得中间那段字
|
||||||
|
// Map<String, Object> map24 = new HashMap<>();
|
||||||
|
// Map<String, Object> map44 = new HashMap<>();
|
||||||
|
// Map<String, Object> map55 = new HashMap<>();
|
||||||
|
// map55.put("value","*" + selectValue + "*");
|
||||||
|
//// if("serial_number".equals(field)){
|
||||||
|
//// map55.put("boost",10);
|
||||||
|
//// }else if("title".equals(field)){
|
||||||
|
//// map55.put("boost",8);
|
||||||
|
//// }else if("file_text".equals(field)){
|
||||||
|
//// map55.put("boost",0.01);
|
||||||
|
//// }else if("content".equals(field)){
|
||||||
|
//// map55.put("boost",0.01);
|
||||||
|
//// }else if("file_name".equals(field)){
|
||||||
|
//// map55.put("boost",5);
|
||||||
|
//// }
|
||||||
|
//
|
||||||
|
// map24.put(field, map55);
|
||||||
|
// map44.put("wildcard",map24);
|
||||||
|
// queryMapJson.add(map44);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// private void getQueryMapJsonFullText(JSONArray queryMapJson, String selectValue, String field) {
|
||||||
// // 前缀匹配 缺点是前缀一定不能断开
|
// // 前缀匹配 缺点是前缀一定不能断开
|
||||||
// //情况举例:用户只记得前面那段字
|
// //情况举例:用户只记得前面那段字
|
||||||
// Map<String, Object> map21 = new HashMap<>();
|
// Map<String, Object> map21 = new HashMap<>();
|
||||||
|
|||||||
Reference in New Issue
Block a user