From 7d5ad1088393364e3baf45b1cdaf412ede739fd5 Mon Sep 17 00:00:00 2001 From: chenshaohua <635616957@qq.com> Date: Thu, 18 Jun 2026 13:22:17 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BF=AE=E6=94=B9=E6=9F=A5=E8=AF=A2es?= =?UTF-8?q?=E6=8E=92=E5=BA=8F=E9=97=AE=E9=A2=98=EF=BC=8C=E4=BC=98=E5=85=88?= =?UTF-8?q?=E6=9D=83=E9=87=8D=EF=BC=8C=E5=9C=A8=E6=8C=89=E7=85=A7=E9=A1=BA?= =?UTF-8?q?=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/ruoyi/cms/service/impl/ESJobSearchImpl.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/impl/ESJobSearchImpl.java b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/impl/ESJobSearchImpl.java index 543ffe8..97461f2 100644 --- a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/impl/ESJobSearchImpl.java +++ b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/impl/ESJobSearchImpl.java @@ -594,6 +594,10 @@ public class ESJobSearchImpl implements IESJobSearchService String formattedEndDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(endDateTime); wrapper.and(x->x.le(ESJobDocument::getPostingDate, formattedEndDate)); } + // 先开启打分、优先按匹配分数排序(关键词前台命中越高越靠前) + 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){