Add support for quoted without spaces and falsey input

This commit is contained in:
gconsidine
2017-09-14 15:57:52 -04:00
parent 57c9224b5c
commit eab3cb8efd
2 changed files with 12 additions and 1 deletions

View File

@@ -7,6 +7,10 @@ export default [function() {
* values before calling to `splitSearchIntoTerms`.
*/
splitFilterIntoTerms (searchString) {
if (!searchString) {
return null;
}
let groups = [];
let quoted;
@@ -16,7 +20,11 @@ export default [function() {
searchString.split(' ').forEach(substring => {
if (substring.includes(':"')) {
quoted = substring;
if (/"$/.test(substring)) {
groups.push(this.encode(substring));
} else {
quoted = substring;
}
} else if (quoted) {
quoted += ` ${substring}`;