23 lines
494 B
JavaScript
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);
|
|
});
|
|
});
|
|
})
|
|
;
|