blob: 16caf962564f4a8766d72d55ae57ceb82e44d84b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
const GitBook = require('gitbook-core');
const lunr = require('lunr');
/**
* Search in the local index
* @param {String} query
* @return {Promise<List>}
*/
function searchHandler(query) {
return [
{ title: 'Hello world' }
];
}
module.exports = GitBook.createPlugin({
init: (dispatch, getState, actions) => {
const { search } = actions;
dispatch(search.registerHandler('lunr', searchHandler));
},
reduce: (state, action) => state
});
|