1.修改查询招聘会日期报错问题

2.修改查询es不出来的问题
This commit is contained in:
chenshaohua
2026-06-18 13:12:56 +08:00
parent aa9a817308
commit 3502be6478
2 changed files with 28 additions and 9 deletions

View File

@@ -488,12 +488,33 @@ public class ESJobSearchImpl implements IESJobSearchService
private LambdaEsQueryWrapper<ESJobDocument> getWrapper(ESJobSearch esJobSearch,List<Long> jobIds){
LambdaEsQueryWrapper<ESJobDocument> wrapper = new LambdaEsQueryWrapper<>();
if(!StringUtil.isEmptyOrNull(esJobSearch.getJobTitle())){
/*if(!StringUtil.isEmptyOrNull(esJobSearch.getJobTitle())){
for (String keyWord:esJobSearch.getJobTitle().split(",")) {
wrapper.and(a -> a.match(ESJobDocument::getJobTitle, keyWord, 5.0f)
);
}
}*/
//优化岗位名称查询,只有命中岗位名称或者分类就行
String titleStr = esJobSearch.getJobTitle();
String cateStr = esJobSearch.getJobCategory();
if (!StringUtil.isEmptyOrNull(titleStr) || !StringUtil.isEmptyOrNull(cateStr)) {
wrapper.and(sub -> {
boolean first = true;
sub.or();
if (!StringUtil.isEmptyOrNull(titleStr)) {
String[] words = titleStr.split(",");
for (String w : words) {
if (!first) sub.or();
sub.match(ESJobDocument::getJobTitle, w, 5.0f);
first = false;
}
}
if (!StringUtil.isEmptyOrNull(cateStr)) {
if (!first) sub.or();
sub.eq(ESJobDocument::getJobCategory, cateStr);
}
});
}
if(esJobSearch.getLongitude()!=null){
@@ -523,10 +544,10 @@ public class ESJobSearchImpl implements IESJobSearchService
Integer maxValue = StringUtil.findMaxValue(esJobSearch.getExperience());
wrapper.and(x->x.eq(ESJobDocument::getExperience_int,maxValue));
}
if(!StringUtil.isEmptyOrNull(esJobSearch.getJobCategory())){
String targetValue = esJobSearch.getJobCategory();
wrapper.and(x -> x.eq(ESJobDocument::getJobCategory, targetValue));
}
// if(!StringUtil.isEmptyOrNull(esJobSearch.getJobCategory())){
// String targetValue = esJobSearch.getJobCategory();
// wrapper.and(x -> x.eq(ESJobDocument::getJobCategory, targetValue));
// }
if(!StringUtil.isEmptyOrNull(esJobSearch.getScale())){
Integer maxValue = StringUtil.findMaxValue(esJobSearch.getScale());
wrapper.and(x->x.le(ESJobDocument::getScale,maxValue));
@@ -550,9 +571,6 @@ public class ESJobSearchImpl implements IESJobSearchService
if(!StringUtil.isEmptyOrNull(esJobSearch.getCode())){
wrapper.and(x->x.eq(ESJobDocument::getCode,esJobSearch.getCode()));
}
if(!StringUtil.isEmptyOrNull(esJobSearch.getType())){
wrapper.and(x->x.eq(ESJobDocument::getType,esJobSearch.getType()));
}
if(esJobSearch.getJobId()!=null){
wrapper.and(x->x.eq(ESJobDocument::getJobId,esJobSearch.getJobId()));
}
@@ -917,6 +935,7 @@ public class ESJobSearchImpl implements IESJobSearchService
relaxConditions.add(() -> newSearch.setMaxSalary(null));
relaxConditions.add(() -> newSearch.setMinSalary(null));
relaxConditions.add(() -> newSearch.setEducation(null));
relaxConditions.add(()-> newSearch.setJobCategory(null));
relaxConditions.add(()-> newSearch.setJobTitle(null));
// 保存所有查询到的文档
List<ESJobDocument> allDocuments = new ArrayList<>(esJobDocuments);

View File

@@ -257,7 +257,7 @@
generate_series(
DATE_TRUNC('day', f.job_fair_start_time),
DATE_TRUNC('day', f.job_fair_end_time),
'1 day'::interval
make_interval(days => 1)
) AS d(date)
WHERE f.del_flag = '0'
ORDER BY date