docusaurus-lunr-search
docusaurus-lunr-search copied to clipboard
Unhandled Rejection (TypeError): Cannot read property 'forEach' of undefined
Function.lunr.Pipeline.load C:\Users\Karan\Desktop\TargeV2\rust-doc\node_modules\lunr\lunr.js:575 572 | lunr.Pipeline.load = function (serialised) { 573 | var pipeline = new lunr.Pipeline 574 |
575 | serialised.forEach(function (fnName) { 576 | var fn = lunr.Pipeline.registeredFunctions[fnName] 577 | 578 | if (fn) { View compiled Function.lunr.Index.load C:\Users\Karan\Desktop\TargeV2\rust-doc\node_modules\lunr\lunr.js:2286 2283 | invertedIndex = Object.create(null), 2284 | serializedInvertedIndex = serializedIndex.invertedIndex, 2285 | tokenSetBuilder = new lunr.TokenSet.Builder, 2286 | pipeline = lunr.Pipeline.load(serializedIndex.pipeline) | ^ 2287 | 2288 | if (serializedIndex.version != lunr.version) { 2289 | lunr.utils.warn("Version mismatch when loading serialised index. Current version of lunr '" + lunr.version + "' does not match serialized index '" + serializedIndex.version + "'") View compiled new LunrSearchAdapter webpack-internal:///./src/theme/SearchBar/lib/lunar-search.js:3:266 new DocSearch C:/Users/Karan/Desktop/TargeV2/rust-doc/src/theme/SearchBar/lib/DocSearch.js:141 138 | /** 139 | * Returns the
source
method to be passed to autocomplete.js. It will query 140 | * the Algolia index and call the callbacks with the formatted hits. 141 | * @function getAutocompleteSource | ^ 142 | * @param {function} transformData An optional function to transform the hits 143 | * @param {function} queryHook An optional function to transform the query 144 | * @returns {function} Method to be passed as thesource
option of
Getting this error when following the guide help please !!!!!!!!
From the README
Note: Docusaurus search information can only be generated from a production build. Local development is currently not supported.
So I think you'll need to do npm run serve
to test out the search functionality.
That said, any chance you can add some null checks to prevent the exception? I'm good not having search enabled in dev mode, but sometimes I accidentally mouse over the search box and get presented with the error screen.
EDIT: Ah just saw a workaround in #33
That's it, it worked for me, but should we worry about the current Docusaurus swizzle caution for v2 in the near future?