Skip to content

Commit

Permalink
Fix frontend JS
Browse files Browse the repository at this point in the history
  • Loading branch information
rstacruz committed Oct 20, 2015
1 parent 31d9e93 commit 2807aec
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions data/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ var lunr = require('lunr')
window.Search = (function () {
var Search = {}

Search.lunr = lunr.Index.load(JSON.parse(window.__lunrindex))
Search.lunr = lunr.Index.load(window.__lunrindex)

Search.search = function (keywords) {
var results = Search.lunr.search(keywords)
return results.map(function (result) {
// result == { ref: 'index.html#usage', score: 0.99 }
return window.__lunrindex[result.ref]
return window.__searchindex[result.ref]
})
}

Expand Down
8 changes: 4 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ function addJs (files, ms, done) {
if (err) return done(err)
contents =
'window.__searchindex=(' +
JSON.stringify(files['_docpress.json'].searchIndex) +
')\n' +
JSON.stringify(files['_docpress.json'].searchIndex, null, 2) +
');\n' +
'window.__lunrindex=(' +
files['_docpress.json'].lunrIndex +
')\n' + contents
');\n' + contents
files['assets/search.js'] = { contents }
done()
}
Expand Down Expand Up @@ -110,7 +110,7 @@ function lunrize (idx) {
function extendIndex (file, block) {
delete file.contents
block(file)
file.contents = JSON.stringify(file, null, 2)
file.contents = JSON.stringify(file)
}

/**
Expand Down

0 comments on commit 2807aec

Please sign in to comment.