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 CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "4.1.8",
2
+ "version": "4.1.9",
3
3
  "author": "Steve Fenton",
4
4
  "name": "astro-accelerator",
5
5
  "description": "A super-lightweight, accessible, SEO-friendly starter project for Astro",
@@ -306,7 +306,7 @@ function initializeSearch() {
306
306
  }
307
307
 
308
308
  /** @type {SearchEntry[]} */
309
- const needles = [];
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;