astro-accelerator 4.1.8 → 4.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/public/js/search.js +4 -2
package/package.json
CHANGED
package/public/js/search.js
CHANGED
|
@@ -306,7 +306,7 @@ function initializeSearch() {
|
|
|
306
306
|
}
|
|
307
307
|
|
|
308
308
|
/** @type {SearchEntry[]} */
|
|
309
|
-
|
|
309
|
+
let needles = [];
|
|
310
310
|
|
|
311
311
|
// Clean the input
|
|
312
312
|
const cleanQuery = sanitise(s);
|
|
@@ -377,6 +377,7 @@ function initializeSearch() {
|
|
|
377
377
|
// Title
|
|
378
378
|
if (contains(item.safeTitle, term)) {
|
|
379
379
|
item.score = item.score + scoring.termTitle;
|
|
380
|
+
item.foundWords += scores.titleContains / 2;
|
|
380
381
|
isTermFound = true;
|
|
381
382
|
}
|
|
382
383
|
|
|
@@ -384,6 +385,7 @@ function initializeSearch() {
|
|
|
384
385
|
item.headings.forEach((c) => {
|
|
385
386
|
if (contains(c.safeText, term)) {
|
|
386
387
|
item.score = item.score + scoring.termHeading;
|
|
388
|
+
item.foundWords += scores.headingContains / 2;
|
|
387
389
|
isTermFound = true;
|
|
388
390
|
|
|
389
391
|
if (
|
|
@@ -446,7 +448,7 @@ function initializeSearch() {
|
|
|
446
448
|
}
|
|
447
449
|
});
|
|
448
450
|
|
|
449
|
-
needles.sort(function (a, b) {
|
|
451
|
+
needles = needles.sort(function (a, b) {
|
|
450
452
|
if (b.foundTerms.length === a.foundTerms.length) {
|
|
451
453
|
if (b.foundWords === a.foundWords) {
|
|
452
454
|
return b.score - a.score;
|