Wash better #133
1 changed files with 3 additions and 1 deletions
|
@ -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) }
|
||||||
|
|
Loading…
Reference in a new issue