diff options
author | 2024-07-25 20:14:40 +0000 | |
---|---|---|
committer | 2024-07-25 20:14:40 +0000 | |
commit | 1b5df35d18c35944b272121281e2edbdec5e3cac (patch) | |
tree | a7517831960b9394ee9802913d71c0ec37b35d07 /_static/searchtools.js | |
parent | Deploying to docs from @ python-discord/bot-core@e5023a0480337666bfe88874a669... (diff) |
Deploying to docs from @ python-discord/bot-core@8a9d7f0bd1b64f967fe5848f6b2c38d8575b39fc 🚀
Diffstat (limited to '_static/searchtools.js')
-rw-r--r-- | _static/searchtools.js | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/_static/searchtools.js b/_static/searchtools.js index 92da3f8b..b08d58c9 100644 --- a/_static/searchtools.js +++ b/_static/searchtools.js @@ -178,7 +178,7 @@ const Search = { htmlToText: (htmlString, anchor) => { const htmlElement = new DOMParser().parseFromString(htmlString, 'text/html'); - for (const removalQuery of [".headerlinks", "script", "style"]) { + for (const removalQuery of [".headerlink", "script", "style"]) { htmlElement.querySelectorAll(removalQuery).forEach((el) => { el.remove() }); } if (anchor) { @@ -328,13 +328,14 @@ const Search = { for (const [title, foundTitles] of Object.entries(allTitles)) { if (title.toLowerCase().trim().includes(queryLower) && (queryLower.length >= title.length/2)) { for (const [file, id] of foundTitles) { - let score = Math.round(100 * queryLower.length / title.length) + const score = Math.round(Scorer.title * queryLower.length / title.length); + const boost = titles[file] === title ? 1 : 0; // add a boost for document titles normalResults.push([ docNames[file], titles[file] !== title ? `${titles[file]} > ${title}` : title, id !== null ? "#" + id : "", null, - score, + score + boost, filenames[file], ]); } |