fix: use fuse.js for both fuzzy search and full-text search

This commit is contained in:
Tienson Qin
2021-02-21 21:54:46 +08:00
parent 88d1fa8b91
commit fdd1538820
6 changed files with 64 additions and 82 deletions

View File

@@ -204,13 +204,3 @@ export const win32 = path => {
// UNC paths are always absolute
return Boolean(result[2] || isUnc);
};
export const searchTokenize = str => {
let ascii_words = str.split(/\W+/);
let non_ascii_str = str.replace(/[\x00-\x7F]/g, '');
if (non_ascii_str == '') {
return ascii_words;
} else {
return ascii_words.concat(non_ascii_str.split('')).filter(e => !!e);
}
};