Improve to search tags

This commit is contained in:
koirand 2020-01-18 11:01:03 -10:00
parent 18da0b5509
commit 16d05fc1f4
2 changed files with 2 additions and 9 deletions

View file

@ -16,15 +16,6 @@ const bigramTokeniser = (obj, metadata) => {
return []
}
if (Array.isArray(obj)) {
return obj.map((t) => {
return new lunr.Token(
lunr.utils.asString(t).toLowerCase(),
lunr.utils.clone(metadata)
)
})
}
let str = obj.toString().trim().toLowerCase()
let tokens = []
@ -70,6 +61,7 @@ const initLunr = () => {
builder.pipeline.reset()
builder.ref('ref')
builder.field('title', { boost: 10 })
builder.field('tags', { boost: 10 })
builder.field('body')
builder.metadataWhitelist = ['position']
for (let page of pagesIndex) {

View file

@ -3,6 +3,7 @@
"ref": "{{ $page.Permalink }}",
"title": {{ $page.Title | jsonify }},
"section": "{{ $page.Section }}",
"tags": {{ $page.Params.tags | jsonify }},
"date" : {{ $page.Date.Format "2006.01.02" | jsonify }},
"body": {{ $page.Plain | jsonify }}
}