搜索中心-全部-排序优化

This commit is contained in:
liyawei
2022-09-02 16:39:16 +08:00
parent 1ef3af98ac
commit a206eeb968
2 changed files with 23 additions and 11 deletions
@@ -555,15 +555,15 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
Map<String, Object> map31 = new HashMap<>();
Map<String, Object> map41 = new HashMap<>();
if("serial_number".equals(field)){
map31.put("boost",1);
map31.put("boost",10);
}else if("title".equals(field)){
map31.put("boost",1);
map31.put("boost",10);
}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",1);
map31.put("boost",10);
}
map31.put("value", selectValue);
map21.put(field + ".keyword", map31);
@@ -575,15 +575,15 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
Map<String, Object> map32 = new HashMap<>();
Map<String, Object> map42 = new HashMap<>();
if("serial_number".equals(field)){
map32.put("boost",1);
map32.put("boost",10);
}else if("title".equals(field)){
map32.put("boost",1);
map32.put("boost",10);
}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",1);
map32.put("boost",10);
}
map32.put("query", selectValue);
map22.put(field, map32);
@@ -593,8 +593,21 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
// match分词匹配查询
// 情况举例:用户可能他知道开头的前缀几个字,知道中间的几个字
Map<String, Object> map23 = new HashMap<>();
Map<String, Object> map33 = new HashMap<>();
Map<String, Object> map43 = new HashMap<>();
map23.put(field, selectValue);
if("serial_number".equals(field)){
map33.put("boost",10);
}else if("title".equals(field)){
map33.put("boost",10);
}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("query", selectValue);
map23.put(field, map33);
map43.put("match", map23);
queryMapJson.add(map43);
@@ -251,7 +251,7 @@ public class LawsMonthlyReportSearchServiceImpl implements ILawsMonthlyReportSea
if("title".equals(field)){
map31.put("boost",10);
}else if("content".equals(field)){
map31.put("boost",2);
map31.put("boost",0.01);
}
map31.put("value", selectValue);
map21.put(field + ".keyword", map31);
@@ -265,7 +265,7 @@ public class LawsMonthlyReportSearchServiceImpl implements ILawsMonthlyReportSea
if("title".equals(field)){
map32.put("boost",10);
}else if("content".equals(field)){
map32.put("boost",2);
map32.put("boost",0.01);
}
map32.put("query", selectValue);
map22.put(field, map32);
@@ -280,11 +280,10 @@ public class LawsMonthlyReportSearchServiceImpl implements ILawsMonthlyReportSea
if("title".equals(field)){
map33.put("boost",10);
}else if("content".equals(field)){
map33.put("boost",2);
map33.put("boost",0.01);
}
map33.put("query", selectValue);
map23.put(field, map33);
map23.put(field, selectValue);
map43.put("match", map23);
queryMapJson.add(map43);