Skip to content

Commit 0f65765

Browse files
author
David Barrett
committed
Reencode regexp as string
1 parent 76f4c45 commit 0f65765

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

addon/services/docs-search.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export default Service.extend({
1212
search(phrase) {
1313
return this.loadSearchIndex()
1414
.then(({ index, documents }) => {
15-
let words = phrase.toLowerCase().split(config['ember-cli-addon-docs'].searchTokenSeparator);
15+
let words = phrase.toLowerCase().split(new RegExp(config['ember-cli-addon-docs'].searchTokenSeparator));
1616
let results = index.query((query) => {
1717
// In the future we could boost results based on the field they come from
1818
for (let word of words) {

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ module.exports = {
4848
projectTag: this.parent.pkg.version,
4949
projectHref: info && info.browse(),
5050
deployVersion: 'ADDON_DOCS_DEPLOY_VERSION',
51-
searchTokenSeparator: /\s+/
51+
searchTokenSeparator: "\\s+"
5252
}
5353
};
5454

lib/broccoli/search-indexer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ module.exports = class SearchIndexCompiler extends Writer {
2727
this.field('text');
2828
this.field('keywords');
2929

30-
this.tokenizer.separator = writer.config['ember-cli-addon-docs'].searchTokenSeparator;
30+
this.tokenizer.separator = new RegExp(writer.config['ember-cli-addon-docs'].searchTokenSeparator);
3131

3232
for (let doc of writer.buildDocuments()) {
3333
if (doc) {

0 commit comments

Comments
 (0)