mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-06 09:26:48 +08:00
ES搜索调整
This commit is contained in:
@@ -408,8 +408,8 @@ public class CourseElasticsearchImpl implements ICourseFullTextSearch{
|
||||
// System.out.println(words);
|
||||
|
||||
BoolQueryBuilder keywordQuery = QueryBuilders.boolQuery();
|
||||
keywordQuery.should(QueryBuilders.wildcardQuery("name", "*"+words+"*").boost(9f));
|
||||
keywordQuery.should(QueryBuilders.wildcardQuery("teacher", "*"+words+"*").boost(7f));
|
||||
keywordQuery.should(QueryBuilders.wildcardQuery("name.keyword", "*"+words+"*").boost(9f));
|
||||
keywordQuery.should(QueryBuilders.wildcardQuery("teacher.keyword", "*"+words+"*").boost(7f));
|
||||
//keywordQuery.should(QueryBuilders.queryStringQuery(words).field("name", 9f));//用此方法无法查询出有转义符的处理
|
||||
//keywordQuery.should(QueryBuilders.queryStringQuery(words).field("teacher", 8f));
|
||||
|
||||
|
||||
@@ -187,7 +187,7 @@ public class CourseStudyElasticsearchImpl implements ICourseStudySearch{
|
||||
BoolQueryBuilder boolQuery= QueryBuilders.boolQuery();
|
||||
if(StringUtils.isNotBlank(dto.getCourseName())) {
|
||||
String words=QueryParser.escape(dto.getCourseName());
|
||||
boolQuery.filter(QueryBuilders.wildcardQuery("courseName", "*"+words+"*"));
|
||||
boolQuery.filter(QueryBuilders.wildcardQuery("courseName.keyword", "*"+words+"*"));
|
||||
}
|
||||
if(dto.getCourseType()!=null) {
|
||||
if(dto.getCourseType()==10 || dto.getCourseType()==20) {
|
||||
|
||||
Reference in New Issue
Block a user