Commit 83adf4b7 by 王明范

fix

parent 8db1aac2
......@@ -285,6 +285,9 @@ public class SuggestTask {
for(int i = 0;i< keyList.size(); i++) {
String word = keyList.get(i);
EsSuggestKeywordInfo suggestInfo = esSuggestKeywordMap.get(word);
if (suggestInfo == null) {
continue;
}
int wordLen = StringUtils.getByteLength(word);
int length = word.length();
if (wordLen > 3 && wordLen <= 18 && StringUtils.isBlank(suggestInfo.getSuggestTags())) {
......@@ -297,17 +300,12 @@ public class SuggestTask {
break;
}
String fulWord = keyList.get(j);
int fulLen = StringUtils.getByteLength(fulWord);
if (fulWord.startsWith(word) && fulLen - wordLen > 3 && fulLen - wordLen <= 12) {
int rightLen = StringUtils.getByteLength(fulWord) - wordLen;
if (fulWord.startsWith(word) && rightLen > 3 && rightLen <= 12) {
String subWord = fulWord.substring(length, length + 1);
String rightWord = fulWord.substring(length, fulWord.length()).trim();
if (isEN && StringUtils.isEnStr(subWord)){
continue;
}
int rightLen = StringUtils.getByteLength(rightWord);
if (rightLen - wordLen <= 3 || rightLen - wordLen > 12) {
break;
}
suggestList.add(esSuggestKeywordMap.get(fulWord));
keyCount++;
} else {
......@@ -341,7 +339,7 @@ public class SuggestTask {
sb.append(subWord);
}
if (sb.length() > 0) {
esSuggestKeywordMap.get(word).setSuggestTags(sb.toString());
suggestInfo.setSuggestTags(sb.toString());
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment