mirror of
https://github.com/Brandon-Rozek/website-theme.git
synced 2024-11-21 15:56:29 -05:00
Improve to search tags
This commit is contained in:
parent
18da0b5509
commit
16d05fc1f4
2 changed files with 2 additions and 9 deletions
|
@ -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) {
|
||||
|
|
|
@ -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 }}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue