搜索中心--全部(添加权重-->编号(10)>标题(8)>文件名称(5))
This commit is contained in:
+27
-7
@@ -526,6 +526,7 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
|
||||
}
|
||||
|
||||
JSONObject sort = new JSONObject();
|
||||
// JSONObject sort = new JSONObject(new LinkedHashMap<>());
|
||||
if(StringUtils.isEmpty(selectValue) || StringUtils.equals(selectValue,SEARCH_FLAG)){
|
||||
Map<String,Object> createTime = new HashMap<>();
|
||||
Map<String,Object> createTime1 = new HashMap<>();
|
||||
@@ -537,7 +538,12 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
|
||||
Map<String,Object> score1 = new HashMap<>();
|
||||
score.put("order","desc");
|
||||
score1.put("_score",score);
|
||||
// Map<String,Object> score2 = new HashMap<>();
|
||||
// Map<String,Object> score3 = new HashMap<>();
|
||||
// score2.put("order","desc");
|
||||
// score3.put("_id",score2);
|
||||
sort.putAll(score1);
|
||||
// sort.putAll(score3);
|
||||
}
|
||||
log.info("搜索中心-全部索引,排序方式为:" + sort.toJSONString());
|
||||
|
||||
@@ -563,13 +569,13 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
|
||||
if("serial_number".equals(field)){
|
||||
map31.put("boost",10);
|
||||
}else if("title".equals(field)){
|
||||
map31.put("boost",10);
|
||||
map31.put("boost",8);
|
||||
}else if("file_text".equals(field)){
|
||||
map31.put("boost",0.01);
|
||||
}else if("content".equals(field)){
|
||||
map31.put("boost",0.01);
|
||||
}else if("file_name".equals(field)){
|
||||
map31.put("boost",10);
|
||||
map31.put("boost",5);
|
||||
}
|
||||
map31.put("value", selectValue);
|
||||
map21.put(field + ".keyword", map31);
|
||||
@@ -583,13 +589,13 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
|
||||
if("serial_number".equals(field)){
|
||||
map32.put("boost",10);
|
||||
}else if("title".equals(field)){
|
||||
map32.put("boost",10);
|
||||
map32.put("boost",8);
|
||||
}else if("file_text".equals(field)){
|
||||
map32.put("boost",0.01);
|
||||
}else if("content".equals(field)){
|
||||
map32.put("boost",0.01);
|
||||
}else if("file_name".equals(field)){
|
||||
map32.put("boost",10);
|
||||
map32.put("boost",5);
|
||||
}
|
||||
map32.put("query", selectValue);
|
||||
map22.put(field, map32);
|
||||
@@ -604,13 +610,13 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
|
||||
if("serial_number".equals(field)){
|
||||
map33.put("boost",10);
|
||||
}else if("title".equals(field)){
|
||||
map33.put("boost",10);
|
||||
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",10);
|
||||
map33.put("boost",5);
|
||||
}
|
||||
map33.put("query", selectValue);
|
||||
map23.put(field, map33);
|
||||
@@ -621,7 +627,21 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
|
||||
//情况举例:用户只记得中间那段字
|
||||
Map<String, Object> map24 = new HashMap<>();
|
||||
Map<String, Object> map44 = new HashMap<>();
|
||||
map24.put(field, "*" + selectValue + "*");
|
||||
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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user