blob: 0eb6e04a85e3af594da2413d06599adcee959e4b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
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, { Search }) => {
dispatch(Search.registerHandler('lunr', searchHandler));
},
reduce: (state, action) => state
});
|