include tags in search

This commit is contained in:
Mirek Kratochvil 2023-07-16 19:33:07 +02:00
parent 00d1e45682
commit 0749bee908
2 changed files with 6 additions and 2 deletions

View file

@ -6,6 +6,7 @@ redirects:
- old:mypage
tags:
- about/test
- something/thencefence
---
# My Testing Page

View file

@ -26,10 +26,13 @@ documents = JSON.parse(fs.readFileSync(process.argv[2], {encoding: 'utf8'}))
var idx = lunr(function () {
this.ref('link')
this.field('title', {boost: 10})
this.field('title', {boost: 9})
this.field('tag', {boost: 3})
this.field('text')
documents.forEach(function (doc) {
this.add(doc)
const {link, title, text, tags} = doc;
this.add({link, title, text, tag:tags.map(x => x.join(" ")).join("\n")})
}, this)
})