Created
June 10, 2014 13:36
-
-
Save artcommacode/4ecc05c0167a15d317c0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var index = lunr(function () { | |
this.field('title', {boost: 10}); | |
this.field('text'); | |
this.ref('_id'); | |
}); | |
pages.forEach(function (page) { | |
if (page.album) index.add(page); | |
}); | |
render.results = index.search(query).map(function (result) { | |
result.page = _.first(pages.filter(function (page) { | |
return page.id === result.ref; | |
})); | |
return result; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment