chore: search tuning

This commit is contained in:
Cory Dransfeldt 2024-03-18 15:06:09 -07:00
parent e3fd1994e6
commit 3c17f9b405
No known key found for this signature in database
2 changed files with 2 additions and 2 deletions

View file

@ -1,6 +1,6 @@
{
"name": "coryd.dev",
"version": "8.0.3",
"version": "8.1.3",
"description": "The source for my personal site. Built using 11ty.",
"type": "module",
"scripts": {

View file

@ -32,7 +32,7 @@
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) => {
$results.innerHTML = results.map(({ title, url }) => {
return `<li class="search__results--result"><a href="${url}">${title}</a></li>`