mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-07 01:46:47 +08:00
学习课程ES相关的修改
This commit is contained in:
@@ -56,6 +56,15 @@ public interface ICourseStudySearch {
|
||||
*/
|
||||
void updateFieldByDocId(String field,Object value, String docId) throws Exception;
|
||||
|
||||
/**
|
||||
* 更新状态和进度
|
||||
* @param docId
|
||||
* @param status
|
||||
* @param process
|
||||
* @throws Exception
|
||||
*/
|
||||
void updateStatusAndProcessByDocId(String docId,int status,int process) throws Exception;
|
||||
|
||||
/**
|
||||
* 移除课程
|
||||
* @param id
|
||||
|
||||
@@ -180,16 +180,30 @@ 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+"*").boost(9f));
|
||||
boolQuery.filter(QueryBuilders.wildcardQuery("courseName", "*"+words+"*"));
|
||||
}
|
||||
if(dto.getCourseType()!=null) {
|
||||
boolQuery.filter(QueryBuilders.termQuery("courseType",dto.getCourseType()));
|
||||
if(dto.getCourseType()==10) {
|
||||
int[] types=new int[] {10,20};
|
||||
boolQuery.filter(QueryBuilders.termsQuery("courseType",types));
|
||||
}else {
|
||||
boolQuery.filter(QueryBuilders.termQuery("courseType",dto.getCourseType()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(dto.getStatus()!=null) {
|
||||
boolQuery.filter(QueryBuilders.termQuery("status",dto.getStatus()));
|
||||
}
|
||||
|
||||
if(dto.getSource()!=null) {
|
||||
boolQuery.filter(QueryBuilders.termQuery("source",dto.getSource()));
|
||||
}
|
||||
|
||||
if(dto.getAccountId()!=null) {
|
||||
boolQuery.filter(QueryBuilders.termQuery("accountId",dto.getAccountId()));
|
||||
}
|
||||
|
||||
SearchRequest searchRequest = new SearchRequest();
|
||||
searchRequest.indices(IndexName);
|
||||
|
||||
@@ -227,4 +241,10 @@ public class CourseStudyElasticsearchImpl implements ICourseStudySearch{
|
||||
return rs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateStatusAndProcessByDocId(String docId, int status, int process) throws Exception {
|
||||
//更新状态和进度
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user