Skip to content

Commit

Permalink
Merge 77f0742 into 2a9c84e
Browse files Browse the repository at this point in the history
  • Loading branch information
Wardrop committed Dec 18, 2017
2 parents 2a9c84e + 77f0742 commit ff7fc45
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/sifter.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
* @param {string} query
* @returns {array}
*/
Sifter.prototype.tokenize = function(query) {
Sifter.prototype.tokenize = function(query, respect_word_boundaries) {
query = trim(String(query || '').toLowerCase());
if (!query || !query.length) return [];

Expand All @@ -62,6 +62,7 @@
}
}
}
if (respect_word_boundaries) regex = "\\b"+regex
tokens.push({
string : words[i],
regex : new RegExp(regex, 'i')
Expand Down Expand Up @@ -318,7 +319,7 @@
return {
options : options,
query : String(query || '').toLowerCase(),
tokens : this.tokenize(query),
tokens : this.tokenize(query, options.respect_word_boundaries),
total : 0,
items : []
};
Expand Down

0 comments on commit ff7fc45

Please sign in to comment.