mirror of
https://github.com/Brandon-Rozek/website-theme.git
synced 2024-11-25 01:26:31 -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 []
|
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 str = obj.toString().trim().toLowerCase()
|
||||||
let tokens = []
|
let tokens = []
|
||||||
|
|
||||||
|
@ -70,6 +61,7 @@ const initLunr = () => {
|
||||||
builder.pipeline.reset()
|
builder.pipeline.reset()
|
||||||
builder.ref('ref')
|
builder.ref('ref')
|
||||||
builder.field('title', { boost: 10 })
|
builder.field('title', { boost: 10 })
|
||||||
|
builder.field('tags', { boost: 10 })
|
||||||
builder.field('body')
|
builder.field('body')
|
||||||
builder.metadataWhitelist = ['position']
|
builder.metadataWhitelist = ['position']
|
||||||
for (let page of pagesIndex) {
|
for (let page of pagesIndex) {
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
"ref": "{{ $page.Permalink }}",
|
"ref": "{{ $page.Permalink }}",
|
||||||
"title": {{ $page.Title | jsonify }},
|
"title": {{ $page.Title | jsonify }},
|
||||||
"section": "{{ $page.Section }}",
|
"section": "{{ $page.Section }}",
|
||||||
|
"tags": {{ $page.Params.tags | jsonify }},
|
||||||
"date" : {{ $page.Date.Format "2006.01.02" | jsonify }},
|
"date" : {{ $page.Date.Format "2006.01.02" | jsonify }},
|
||||||
"body": {{ $page.Plain | jsonify }}
|
"body": {{ $page.Plain | jsonify }}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue