Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions components/SearchBox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ export default {
this.getSuggestions()
},
},
/* global OPTIONS */
/* global FULLTEXT_SEARCH_OPTIONS */
mounted() {
const options = OPTIONS || {}
const options = FULLTEXT_SEARCH_OPTIONS || {}
flexsearchSvc.buildIndex(this.$site.pages, options)
this.placeholder = this.$site.themeConfig.searchPlaceholder || ''
document.addEventListener('keydown', this.onHotkey)
Expand Down
5 changes: 4 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,11 @@ module.exports = (options, ctx, globalCtx) => ({
}
},
define() {
if (options.split instanceof RegExp) {
options.split = options.split.source
}
return {
OPTIONS: options,
FULLTEXT_SEARCH_OPTIONS: options,
}
},
})
Expand Down
2 changes: 1 addition & 1 deletion services/flexsearchSvc.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default {
const indexSettings = {
encode: options.encode || 'simple',
tokenize: options.tokenize || 'forward',
split: options.split || /\W+/,
split: options.split ? new RegExp(options.split) : /\W+/,
async: true,
doc: {
id: 'key',
Expand Down