chore: search tuning
This commit is contained in:
parent
e3fd1994e6
commit
3c17f9b405
2 changed files with 2 additions and 2 deletions
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "coryd.dev",
|
"name": "coryd.dev",
|
||||||
"version": "8.0.3",
|
"version": "8.1.3",
|
||||||
"description": "The source for my personal site. Built using 11ty.",
|
"description": "The source for my personal site. Built using 11ty.",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
renderSearchResults(results)
|
renderSearchResults(results)
|
||||||
})
|
})
|
||||||
|
|
||||||
const getSearchResults = (query) => miniSearch.search(query, {}).map(({ id }) => resultsById[id])
|
const getSearchResults = (query) => miniSearch.search(query, { prefix: true, fuzzy: 0.2, boost: { title: 2 } }).map(({ id }) => resultsById[id])
|
||||||
const renderSearchResults = (results) => {
|
const renderSearchResults = (results) => {
|
||||||
$results.innerHTML = results.map(({ title, url }) => {
|
$results.innerHTML = results.map(({ title, url }) => {
|
||||||
return `<li class="search__results--result"><a href="${url}">${title}</a></li>`
|
return `<li class="search__results--result"><a href="${url}">${title}</a></li>`
|
||||||
|
|
Reference in a new issue