summaryrefslogtreecommitdiffstats
path: root/packages/gitbook-plugin-lunr/src/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'packages/gitbook-plugin-lunr/src/index.js')
-rw-r--r--packages/gitbook-plugin-lunr/src/index.js14
1 files changed, 8 insertions, 6 deletions
diff --git a/packages/gitbook-plugin-lunr/src/index.js b/packages/gitbook-plugin-lunr/src/index.js
index f1dc913..eab5975 100644
--- a/packages/gitbook-plugin-lunr/src/index.js
+++ b/packages/gitbook-plugin-lunr/src/index.js
@@ -1,20 +1,22 @@
const GitBook = require('gitbook-core');
-const lunr = require('lunr');
+const reduce = require('./reducer');
+const actions = require('./actions');
/**
* Search in the local index
* @param {String} query
* @return {Promise<List>}
*/
-function searchHandler(query) {
- return [
- { title: 'Hello world' }
- ];
+function searchHandler(query, dispatch) {
+ return dispatch(actions.fetch())
+ .then(() => {
+ return [];
+ });
}
module.exports = GitBook.createPlugin({
activate: (dispatch, getState, { Search }) => {
dispatch(Search.registerHandler('lunr', searchHandler));
},
- reduce: (state, action) => state
+ reduce
});