app/job/list修改查询条件排序条件
This commit is contained in:
@@ -618,18 +618,25 @@ public class ESJobSearchImpl implements IESJobSearchService
|
||||
// 先开启打分、优先按匹配分数排序(关键词前台命中越高越靠前)
|
||||
wrapper.trackScores();
|
||||
wrapper.sortByScore(SortOrder.DESC);
|
||||
|
||||
if(Objects.nonNull(esJobSearch.getOrder())){
|
||||
wrapper.sort(SortBuilders.fieldSort("postingDate").order(SortOrder.DESC).missing("_last"));
|
||||
if(esJobSearch.getOrder()==1){
|
||||
wrapper.orderByDesc(ESJobDocument::getIsHot);
|
||||
switch (esJobSearch.getOrder()) {
|
||||
case 0: // 推荐:权重 → 最新发布
|
||||
wrapper.sort(SortBuilders.fieldSort("postingDate").order(SortOrder.DESC).missing("_last"));
|
||||
break;
|
||||
case 1: // 最热:权重 → 热度
|
||||
wrapper.orderByDesc(ESJobDocument::getIsHot);
|
||||
wrapper.orderByDesc(ESJobDocument::getApplyNum);
|
||||
wrapper.orderByDesc(ESJobDocument::getView);
|
||||
break;
|
||||
case 2: // 最新发布:权重 → 最新发布
|
||||
wrapper.sort(SortBuilders.fieldSort("postingDate").order(SortOrder.DESC).missing("_last"));
|
||||
break;
|
||||
case 3: // 最大薪资:权重 → 最高薪资
|
||||
wrapper.orderByDesc(ESJobDocument::getMaxSalary);
|
||||
break;
|
||||
default: // 默认:权重 → 最新发布
|
||||
wrapper.sort(SortBuilders.fieldSort("postingDate").order(SortOrder.DESC).missing("_last"));
|
||||
}
|
||||
if(esJobSearch.getOrder()==3){
|
||||
wrapper.orderByDesc(ESJobDocument::getMaxSalary);
|
||||
}
|
||||
}else{
|
||||
//默认按照发布时间倒叙
|
||||
wrapper.sort(SortBuilders.fieldSort("postingDate").order(SortOrder.DESC).missing("_last"));
|
||||
}
|
||||
//企业用户排除es去除jobIds
|
||||
boolean isCompanyUser = StringUtil.IS_COMPANY_USER.equals(esJobSearch.getUserType());
|
||||
|
||||
Reference in New Issue
Block a user