fix: full-text search

This commit is contained in:
Tienson Qin
2021-02-15 16:45:11 +08:00
parent 5cc006a2eb
commit c13cf6a75e
4 changed files with 5 additions and 16 deletions

View File

@@ -209,15 +209,7 @@ export const searchTokenize = str => {
let ascii_words = str.split(/\W+/);
let non_ascii_str = str.replace(/[\x00-\x7F]/g, '');
if (non_ascii_str == '') {
// forward
const length = str.length;
let token = '';
let tokens = [];
for(let a = 0; a < length; a++){
token += str[a];
tokens.push(token);
};
return tokens;
return ascii_words;
} else {
return ascii_words.concat(non_ascii_str.split('')).filter(e => !!e);
}