Fixed #1755: custom search separator not set

This commit is contained in:
squidfunk 2020-06-13 11:14:31 +02:00
parent 02cd4ed1a6
commit 0eedfbb3f6
9 changed files with 18 additions and 16 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,10 +1,10 @@
{
"assets/javascripts/bundle.js": "assets/javascripts/bundle.594f2bf6.min.js",
"assets/javascripts/bundle.js.map": "assets/javascripts/bundle.594f2bf6.min.js.map",
"assets/javascripts/bundle.js": "assets/javascripts/bundle.883417a8.min.js",
"assets/javascripts/bundle.js.map": "assets/javascripts/bundle.883417a8.min.js.map",
"assets/javascripts/vendor.js": "assets/javascripts/vendor.de50e36d.min.js",
"assets/javascripts/vendor.js.map": "assets/javascripts/vendor.de50e36d.min.js.map",
"assets/javascripts/worker/search.js": "assets/javascripts/worker/search.c03f0417.min.js",
"assets/javascripts/worker/search.js.map": "assets/javascripts/worker/search.c03f0417.min.js.map",
"assets/javascripts/worker/search.js": "assets/javascripts/worker/search.7a2ea5ba.min.js",
"assets/javascripts/worker/search.js.map": "assets/javascripts/worker/search.7a2ea5ba.min.js.map",
"assets/stylesheets/main.css": "assets/stylesheets/main.b8fb47b5.min.css",
"assets/stylesheets/main.css.map": "assets/stylesheets/main.b8fb47b5.min.css.map",
"assets/stylesheets/palette.css": "assets/stylesheets/palette.36d1b78f.min.css",

View File

@ -183,7 +183,7 @@
</div>
{% block scripts %}
<script src="{{ 'assets/javascripts/vendor.de50e36d.min.js' | url }}"></script>
<script src="{{ 'assets/javascripts/bundle.594f2bf6.min.js' | url }}"></script>
<script src="{{ 'assets/javascripts/bundle.883417a8.min.js' | url }}"></script>
{%- set translations = {} -%}
{%- for key in [
"clipboard.copy",
@ -207,7 +207,7 @@
base: "{{ base_url }}",
features: {{ config.theme.features | tojson }},
search: Object.assign({
worker: "{{ 'assets/javascripts/worker/search.c03f0417.min.js' | url }}"
worker: "{{ 'assets/javascripts/worker/search.7a2ea5ba.min.js' | url }}"
}, typeof search !== "undefined" && search)
})
</script>

View File

@ -133,10 +133,12 @@ export class Search {
this.documents = setupSearchDocumentMap(docs)
this.highlight = setupSearchHighlighter(config)
/* Set separator for tokenizer */
lunr.tokenizer.separator = new RegExp(config.separator)
/* If no index was given, create it */
if (typeof index === "undefined") {
this.index = lunr(function() {
pipeline = pipeline || ["trimmer", "stopWordFilter"]
/* Set up alternate search languages */
if (config.lang.length === 1 && config.lang[0] !== "en") {
@ -147,12 +149,12 @@ export class Search {
/* Set up pipeline according to configuration */
this.pipeline.reset()
for (const fn of pipeline)
for (const fn of pipeline!)
this.pipeline.add(lunr[fn])
/* Set up search pipeline according to configuration */
this.searchPipeline.reset()
for (const fn of pipeline)
for (const fn of pipeline!)
this.searchPipeline.add(lunr[fn])
/* Set up fields and reference */