Wash better #133

Merged
tiger5226 merged 1 commit from wash_better into master 2018-11-13 03:39:04 +01:00

View file

@ -318,8 +318,10 @@ function getStatus () {
function getWashedQuery (query) { function getWashedQuery (query) {
// compress multiple white spaces to 1 // compress multiple white spaces to 1
query = query.toLowerCase().replace(/ +/g, ' '); query = query.toLowerCase().replace(/ +/g, ' ');
let splitBy = ['&', '$', ' '];
let regex = new RegExp(splitBy.join('|'), 'gi');
let badWords = [ 'from', 'with', 'not', 'can', 'all', 'are', 'for', 'but', 'and', 'the' ]; let badWords = [ 'from', 'with', 'not', 'can', 'all', 'are', 'for', 'but', 'and', 'the' ];
let words = query.split(' '); let words = query.split(regex);
let sentence = []; let sentence = [];
words.forEach(w => { words.forEach(w => {
if (!badWords.includes(w)) { sentence.push(w) } if (!badWords.includes(w)) { sentence.push(w) }