function initLunr() {
    // First retrieve the index file
    $.getJSON("/hugo-theme-wave/bower_components/lunr.js/PagesIndex.json")
        .done(function(index) {
            pagesIndex = index;
            console.log("index:", pagesIndex);

            // Set up lunrjs by declaring the fields we use
            // Also provide their boost level for the ranking
            lunrIndex = lunr(function() {
                this.field("title", {
                    boost: 10
                });
                this.field("tags", {
                    boost: 5
                });
                this.field("content");

                // ref is the result item identifier (I chose the page URL)
                this.ref("href");
            });

            // Feed lunr with each file and let lunr actually index them
            pagesIndex.forEach(function(page) {
                lunrIndex.add(page);
            });
        })
        .fail(function(jqxhr, textStatus, error) {
            var err = textStatus + ", " + error;
            console.error("Error getting Hugo index flie:", err);
        });
}
// Initialize lunrjs using our generated index file
Initialize lunrjs using our generated index file
Initialize lunrjs using our generated index file
function initLunr() {
    $.getJSON("/hugo-theme-wave/bower_components/lunr.js/PagesIndex.json")
        .done(function(index) {
            pagesIndex = index;
            console.log("index:", pagesIndex);
            lunrIndex = lunr(function() {
                this.field("title", {
                    boost: 10
                });
                this.field("tags", {
                    boost: 5
                });
                this.field("content");
                this.ref("href");
            });
            pagesIndex.forEach(function(page) {
                lunrIndex.add(page);
            });
        })
        .fail(function(jqxhr, textStatus, error) {
            var err = textStatus + ", " + error;
            console.error("Error getting Hugo index flie:", err);
        });
}
function initLunr ( ) { $ . getJSON ( "/hugo-theme-wave/bower_components/lunr.js/PagesIndex.json" ) . done ( function ( index ) { pagesIndex = index ; console . log ( "index:" , pagesIndex ) ; lunrIndex = lunr ( function ( ) { this . field ( "title" , { boost : 10 } ) ; this . field ( "tags" , { boost : 5 } ) ; this . field ( "content" ) ; this . ref ( "href" ) ; } ) ; pagesIndex . forEach ( function ( page ) { lunrIndex . add ( page ) ; } ) ; } ) . fail ( function ( jqxhr , textStatus , error ) { var err = textStatus + ", " + error ; console . error ( "Error getting Hugo index flie:" , err ) ; } ) ; }
Initialize lunrjs using our generated index file
Initialize lunrjs using our generated index file
// First retrieve the index file // Set up lunrjs by declaring the fields we use // Also provide their boost level for the ranking // ref is the result item identifier (I chose the page URL) // Feed lunr with each file and let lunr actually index them