'+ ''+store[ref].title+''+ '
'+ ' '+ ''+store[ref].excerpt.split(" ").splice(0,20).join(" ")+'...
'+ 'var initQuery = function() { // See if we have a search box var searchInput = document.querySelector('input#lunr_search'); if (searchInput === null) { return; } // Function to parse our lunr cache var idx = lunr(function () { this.field('title') this.field('excerpt') this.field('categories') this.field('tags') this.ref('id') this.pipeline.remove(lunr.trimmer) for (var item in store) { this.add({ title: store[item].title, excerpt: store[item].excerpt, categories: store[item].categories, tags: store[item].tags, id: item }) } }); // Run search upon keyup searchInput.addEventListener('keyup', function () { var resultdiv = document.querySelector('#results'); var query = document.querySelector("input#lunr_search").value.toLowerCase(); var result = idx.query(function (q) { query.split(lunr.tokenizer.separator).forEach(function (term) { q.term(term, { boost: 100 }) if(query.lastIndexOf(" ") != query.length-1){ q.term(term, { usePipeline: false, wildcard: lunr.Query.wildcard.TRAILING, boost: 10 }) } if (term != ""){ q.term(term, { usePipeline: false, editDistance: 1, boost: 1 }) } }) }); // Empty the results div while (resultdiv.firstChild) { resultdiv.removeChild(resultdiv.firstChild); } resultdiv.insertAdjacentHTML('afterbegin', '
'+result.length+' Result(s) found
'); for (var item in result) { var ref = result[item].ref; if(store[ref].teaser){ var searchitem = ''+store[ref].excerpt.split(" ").splice(0,20).join(" ")+'...
'+ ''+store[ref].excerpt.split(" ").splice(0,20).join(" ")+'...
'+ '