Closed tinganho closed 9 years ago
Thanks for reporting this error, please let me know what version of lunr you are using (and what version of node). It'd be really useful if you could provide a cut down version of your index and a query that causes the error too.
lunr.js crashed on exactly the same line of code in my case because my German stop word filter did not filter the empty string. Apparently, the document store contained the empty string token, while the token store did not, leading to the error. Of course, there might be a different cause in tinganho's case.
Either way, I might try to find the source of the empty string bug and provide a fix and corresponding test case.
@severinh and @olivernn I removed this line after this.index.pipeline.remove(lunr.stopWordFilter); creating the index caused this problem. I installed it recently with bower@0.4.3
Adding
this.pipeline.add(function (token) {
if (token.length > 0) return token;
})
fixed it for me.
I got this error on some certain search queries
TypeError: Cannot read property 'tf' of undefined at lunr.Index.documentVector (/usr/local/lib/node_modules/grunt-translate/node_modules/lunr/lunr.js:1104:53) at lunr.Index.search (/usr/local/lib/node_modules/grunt-translate/node_modules/lunr/lunr.js:1076:61) at Array.map (native) at lunr.SortedSet.map (/usr/local/lib/node_modules/grunt-translate/node_modules/lunr/lunr.js:574:24) at lunr.Index.search (/usr/local/lib/node_modules/grunt-translate/node_modules/lunr/lunr.js:1075:6) at Search.query (/usr/local/lib/node_modules/grunt-translate/src/modules/search.js:93:24) at module.exports (/usr/local/lib/node_modules/grunt-translate/app/modules/search/searchApi.js:9:21) at callbacks (/usr/local/lib/node_modules/grunt-translate/node_modules/express/lib/router/index.js:161:37) at param (/usr/local/lib/node_modules/grunt-translate/node_modules/express/lib/router/index.js:135:11) at pass (/usr/local/lib/node_modules/grunt-translate/node_modules/express/lib/router/index.js:142:5)