修改appList查询es开启分数排序
This commit is contained in:
@@ -711,18 +711,20 @@ public class ESJobSearchImpl implements IESJobSearchService
|
|||||||
if(hasText(jobQuery.getType())){
|
if(hasText(jobQuery.getType())){
|
||||||
wrapper.and(a->a.eq(ESJobDocument::getType,jobQuery.getType().trim()));
|
wrapper.and(a->a.eq(ESJobDocument::getType,jobQuery.getType().trim()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 先开启打分、优先按匹配分数排序(关键词前台命中越高越靠前)
|
||||||
|
wrapper.trackScores();
|
||||||
|
wrapper.sortByScore(SortOrder.DESC);
|
||||||
if(Objects.nonNull(jobQuery.getOrder())){
|
if(Objects.nonNull(jobQuery.getOrder())){
|
||||||
if (jobQuery.getOrder()==3){
|
wrapper.sort(SortBuilders.fieldSort("postingDate").order(SortOrder.DESC).missing("_last"));
|
||||||
// 最大薪资排序
|
if(jobQuery.getOrder()==1){
|
||||||
wrapper.sort(SortBuilders.fieldSort("maxSalary").order(SortOrder.DESC).missing("_last"));
|
|
||||||
} else {
|
|
||||||
wrapper.sort(SortBuilders.fieldSort("postingDate").order(SortOrder.DESC).missing("_last"));
|
|
||||||
}
|
|
||||||
if (jobQuery.getOrder()==1){
|
|
||||||
wrapper.orderByDesc(ESJobDocument::getIsHot);
|
wrapper.orderByDesc(ESJobDocument::getIsHot);
|
||||||
wrapper.orderByDesc(ESJobDocument::getApplyNum);
|
wrapper.orderByDesc(ESJobDocument::getApplyNum);
|
||||||
wrapper.orderByDesc(ESJobDocument::getView);
|
wrapper.orderByDesc(ESJobDocument::getView);
|
||||||
}
|
}
|
||||||
|
if(jobQuery.getOrder()==3){
|
||||||
|
wrapper.orderByDesc(ESJobDocument::getMaxSalary);
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
//默认按照发布时间倒叙
|
//默认按照发布时间倒叙
|
||||||
wrapper.sort(SortBuilders.fieldSort("postingDate").order(SortOrder.DESC).missing("_last"));
|
wrapper.sort(SortBuilders.fieldSort("postingDate").order(SortOrder.DESC).missing("_last"));
|
||||||
|
|||||||
Reference in New Issue
Block a user