Merge branch 'mk-stricter-tokenizer' into 'master'
use stricter unicode-aware tokenizer separator See merge request lcsb/sps/reploy!4
This commit is contained in:
commit
4cdbf598c0
|
@ -26,7 +26,7 @@
|
||||||
* yarnpkg add lunr
|
* yarnpkg add lunr
|
||||||
*
|
*
|
||||||
* Usage:
|
* 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
|
* 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'}))
|
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 () {
|
var idx = lunr(function () {
|
||||||
this.ref('link')
|
this.ref('link')
|
||||||
this.field('title', {boost: 9})
|
this.field('title', {boost: 9})
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
<script src="{{root}}static/lunr.min.js"></script>
|
<script src="{{root}}static/lunr.min.js"></script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
lunr.QueryLexer.termSeparator = /(\p{P}|\p{S}|\p{Z}|\p{C})+/u;
|
||||||
var el_query = document.getElementById('search_query');
|
var el_query = document.getElementById('search_query');
|
||||||
var el_placeholder = document.getElementById('search_placeholder');
|
var el_placeholder = document.getElementById('search_placeholder');
|
||||||
var el_noquery = document.getElementById('search_noquery');
|
var el_noquery = document.getElementById('search_noquery');
|
||||||
|
|
Loading…
Reference in a new issue