Merge branch 'dev'

This commit is contained in:
wangliwen 2022-12-29 09:28:01 +08:00
commit af93de247d
1 changed files with 10 additions and 1 deletions

View File

@ -101,6 +101,8 @@ import java.util.*;
import java.util.concurrent.*;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
/**
@ -601,8 +603,15 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
}
break;
}
Boolean nonChinese = jsonObject.containsKey("nonChinese") ? jsonObject.getBoolean("nonChinese") : Boolean.FALSE; // 不传默认为中文走全文索引
Pattern isChinese = Pattern.compile("[\u4e00-\u9fa5]"); // 中文
String name = jsonObject.containsKey("name") ? jsonObject.getString("name") : "";
Matcher isChineseMatcher = isChinese.matcher(name);
if (!nonChinese && (isChineseMatcher.matches() && name.length() < 2)) {
nonChinese = Boolean.TRUE;
} else if (name.length() < 2) { // 长度小于分词长度2
nonChinese = Boolean.TRUE;
}
//默认按上架时间降序排列
String orderField;
if (StringUtils.isBlank(jsonObject.getString("orderField"))) {