1.修改查询es排序问题,优先权重,在按照顺序
This commit is contained in:
@@ -594,6 +594,10 @@ public class ESJobSearchImpl implements IESJobSearchService
|
|||||||
String formattedEndDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(endDateTime);
|
String formattedEndDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(endDateTime);
|
||||||
wrapper.and(x->x.le(ESJobDocument::getPostingDate, formattedEndDate));
|
wrapper.and(x->x.le(ESJobDocument::getPostingDate, formattedEndDate));
|
||||||
}
|
}
|
||||||
|
// 先开启打分、优先按匹配分数排序(关键词前台命中越高越靠前)
|
||||||
|
wrapper.trackScores();
|
||||||
|
wrapper.sortByScore(SortOrder.DESC);
|
||||||
|
|
||||||
if(Objects.nonNull(esJobSearch.getOrder())){
|
if(Objects.nonNull(esJobSearch.getOrder())){
|
||||||
wrapper.sort(SortBuilders.fieldSort("postingDate").order(SortOrder.DESC).missing("_last"));
|
wrapper.sort(SortBuilders.fieldSort("postingDate").order(SortOrder.DESC).missing("_last"));
|
||||||
if(esJobSearch.getOrder()==1){
|
if(esJobSearch.getOrder()==1){
|
||||||
|
|||||||
Reference in New Issue
Block a user