aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMirek Kratochvil <exa.exa@gmail.com>2023-09-07 22:14:32 +0200
committerMirek Kratochvil <exa.exa@gmail.com>2023-09-07 22:14:32 +0200
commitf8ae6710e870fd7a2f4210b85ec0d509fe350e28 (patch)
treef90b56d7d17a16c6544d427c0c71ce6cbc9598fe
parent6666730fa01effdedd62ee4b65abe088e29a0ff8 (diff)
downloadreploy-f8ae6710e870fd7a2f4210b85ec0d509fe350e28.tar.gz
reploy-f8ae6710e870fd7a2f4210b85ec0d509fe350e28.tar.bz2
use unicode-aware tokenizer separator
-rw-r--r--scripts/make-search-index.js4
-rw-r--r--templates/searchresults.html1
2 files changed, 4 insertions, 1 deletions
diff --git a/scripts/make-search-index.js b/scripts/make-search-index.js
index 1acc7cd..f923b54 100644
--- a/scripts/make-search-index.js
+++ b/scripts/make-search-index.js
@@ -26,7 +26,7 @@
* yarnpkg add lunr
*
* Usage:
- * site ....some args.... --search-data-output tmp/search-raw.json
+ * reploy ....some args.... --search-data-output tmp/search-raw.json
* node scripts/make-search-index.js tmp/search-raw.json _site/search-index.json _site/search-metadata.json
*/
@@ -40,6 +40,8 @@ if(process.argv.length !== 5) {
documents = JSON.parse(fs.readFileSync(process.argv[2], {encoding: 'utf8'}))
+lunr.tokenizer.separator = /(\p{P}|\p{S}|\p{Z}|\p{C})+/u
+
var idx = lunr(function () {
this.ref('link')
this.field('title', {boost: 9})
diff --git a/templates/searchresults.html b/templates/searchresults.html
index 5044d0b..5ced869 100644
--- a/templates/searchresults.html
+++ b/templates/searchresults.html
@@ -31,6 +31,7 @@
<script src="{{root}}static/lunr.min.js"></script>
<script>
+ lunr.QueryLexer.termSeparator = /(\p{P}|\p{S}|\p{Z}|\p{C})+/u;
var el_query = document.getElementById('search_query');
var el_placeholder = document.getElementById('search_placeholder');
var el_noquery = document.getElementById('search_noquery');