修改es开始时间和截至时间

This commit is contained in:
chenshaohua
2026-07-08 16:38:03 +08:00
parent e70109ec56
commit 303900ad4f

View File

@@ -721,12 +721,12 @@ public class ESJobSearchImpl implements IESJobSearchService
Date startDate = jobQuery.getStartDate();
Date endDate = jobQuery.getEndDate();
if (Objects.nonNull(startDate) && Objects.nonNull(endDate)) {
wrapper.and(w -> w.ge(ESJobDocument::getPostingDate, DateUtils.ES_DATE_FORMATTER.format(startDate.toInstant()))
.le(ESJobDocument::getPostingDate, DateUtils.ES_DATE_FORMATTER.format(endDate.toInstant())));
} else if (Objects.nonNull(startDate)) {
wrapper.ge(ESJobDocument::getPostingDate, DateUtils.ES_DATE_FORMATTER.format(startDate.toInstant()));
wrapper.and(w -> w.ge(ESJobDocument::getPostingDate, startDate)
.le(ESJobDocument::getPostingDate, endDate));
}else if (Objects.nonNull(startDate)) {
wrapper.ge(ESJobDocument::getPostingDate, startDate);
} else if (Objects.nonNull(endDate)) {
wrapper.le(ESJobDocument::getPostingDate, DateUtils.ES_DATE_FORMATTER.format(endDate.toInstant()));
wrapper.le(ESJobDocument::getPostingDate, endDate);
}
// 先开启打分、优先按匹配分数排序(关键词前台命中越高越靠前)
wrapper.trackScores();