Personal_Website/assets/js/lunr.js
2022-06-12 21:14:10 +02:00

23 lines
494 B
JavaScript

const lunr = require('lunr');
fetch("/js/lunr/PagesIndex.json")
.then(res => res.json())
.then(pagesIndex => {
const lunrIndex = lunr(function() {
this.field('title', {
boost: 10,
});
this.field('tags', {
boost: 5,
});
this.field('content');
this.ref('href');
pagesIndex.forEach(page => {
this.add(page);
});
});
})
;