astro-accelerator 0.3.21 → 0.3.23
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 +10 -2
package/package.json
CHANGED
package/public/js/search.js
CHANGED
|
@@ -232,7 +232,7 @@ var currentQuery = '';
|
|
|
232
232
|
var dataUrl = qs('#site-search').dataset.sourcedata;
|
|
233
233
|
|
|
234
234
|
var scoring = {
|
|
235
|
-
depth:
|
|
235
|
+
depth: 5,
|
|
236
236
|
phraseTitle: 60,
|
|
237
237
|
phraseHeading: 20,
|
|
238
238
|
phraseDescription: 20,
|
|
@@ -413,7 +413,7 @@ async function search(s, r) {
|
|
|
413
413
|
|
|
414
414
|
needles.forEach(n => {
|
|
415
415
|
// Bonus points for shallow results, i.e. /features over /features/something/something
|
|
416
|
-
n.score += (n.depth
|
|
416
|
+
n.score += (maxDepth - n.depth) * scoring.depth;
|
|
417
417
|
});
|
|
418
418
|
|
|
419
419
|
needles.sort(function (a, b){
|
|
@@ -588,6 +588,14 @@ fetch(dataUrl)
|
|
|
588
588
|
siteSearchQuery.value = params.get('q') ?? '';
|
|
589
589
|
}
|
|
590
590
|
|
|
591
|
+
for (let key of Object.keys(scoring)) {
|
|
592
|
+
if (params.has(`s_${key}`)) {
|
|
593
|
+
scoring[key] = parseInt(params.get(`s_${key}`) ?? scoring[key].toString(), 10) ;
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
console.log(scoring);
|
|
598
|
+
|
|
591
599
|
debounceSearch();
|
|
592
600
|
})
|
|
593
601
|
.catch((error) => {
|