添加es查询是JobTitle或者JobCategory
This commit is contained in:
@@ -500,18 +500,27 @@ public class ESJobSearchImpl implements IESJobSearchService
|
||||
String cateStr = esJobSearch.getJobCategory();
|
||||
if (!StringUtil.isEmptyOrNull(titleStr) || !StringUtil.isEmptyOrNull(cateStr)) {
|
||||
wrapper.and(sub -> {
|
||||
boolean first = true;
|
||||
sub.or();
|
||||
boolean hasPrev = false;
|
||||
if (!StringUtil.isEmptyOrNull(titleStr)) {
|
||||
String[] words = titleStr.split(",");
|
||||
for (String w : words) {
|
||||
if (!first) sub.or();
|
||||
for (int i = 0; i < words.length; i++) {
|
||||
String w = words[i];
|
||||
sub.match(ESJobDocument::getJobTitle, w, 5.0f);
|
||||
first = false;
|
||||
if (i != words.length - 1) {
|
||||
sub.or();
|
||||
}
|
||||
}
|
||||
hasPrev = true;
|
||||
sub.or();
|
||||
sub.eq(ESJobDocument::getJobCategory, titleStr);
|
||||
}
|
||||
if (!StringUtil.isEmptyOrNull(cateStr)) {
|
||||
if (!first) sub.or();
|
||||
if (!StringUtil.isEmptyOrNull(cateStr) && !cateStr.equals(titleStr)) {
|
||||
if (hasPrev) {
|
||||
sub.or();
|
||||
}
|
||||
sub.match(ESJobDocument::getJobTitle, cateStr, 5.0f);
|
||||
sub.or();
|
||||
sub.eq(ESJobDocument::getJobCategory, cateStr);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user