diff --git a/assets/js/lunr.js b/assets/js/lunr.js index 0eb2e67..874ac1b 100644 --- a/assets/js/lunr.js +++ b/assets/js/lunr.js @@ -1,6 +1,7 @@ const lunr = require('lunr'); fetch("/js/lunr/PagesIndex.json") + .then(res => res.json()) .then(pagesIndex => { const lunrIndex = lunr(function() { this.field('title', { @@ -12,10 +13,10 @@ fetch("/js/lunr/PagesIndex.json") this.field('content'); this.ref('href'); - }); - pagesIndex.forEach(page => { - lunrIndex.add(page); + pagesIndex.forEach(page => { + this.add(page); + }); }); }) ;