elasticlunr.js icon indicating copy to clipboard operation
elasticlunr.js copied to clipboard

TypeError: lunr.generateStopWordFilter is not a function :When using lunr-languages

Open farhat-h opened this issue 6 years ago • 9 comments

##Here is my code const elasticLunr = require('elasticlunr'); require('lunr-languages/lunr.stemmer.support')(elasticLunr) require('lunr-languages/lunr.fr')(elasticLunr);

let index = elasticLunr(function () { this.use(elasticLunr.fr); this.addField('title'); this.addField('body'); });

index.addDoc(data); console.log(index.search('recueille les informaions'));

I get this error when i want to integrate lunr-languages, Please help

farhat-h avatar Apr 06 '18 21:04 farhat-h

Hi there @uvuwuewuewue

I guess you use the wrong language-package. Take this one: https://github.com/weixsong/lunr-languages I ran into the same error.

Not sure, but there seems to be some differences in lunr and elasticlunr implementation. The one you are referring to is compatible with only lunr.

ToLuSt avatar Apr 06 '18 21:04 ToLuSt

Indeed, thanks for the help :+1:

farhat-h avatar Apr 06 '18 22:04 farhat-h

Thanks @ToLuSt !

Just in case somebody else using npm runs into this issue in the future, this didn't work for me: npm install lunr-languages

This did work: npm install git+https://github.com/weixsong/lunr-languages.git

gmmarc avatar May 23 '18 11:05 gmmarc

The link to https://github.com/weixsong/lunr-languages is broken!

I then used https://github.com/MihaiValentin/lunr-languages and now I get the same error...

kaijauk avatar Mar 24 '19 17:03 kaijauk

The link to https://github.com/weixsong/lunr-languages is broken!

I then used https://github.com/MihaiValentin/lunr-languages and now I get the same error...

I got the same error again.

lucagentile avatar Mar 28 '19 15:03 lucagentile

The link to https://github.com/weixsong/lunr-languages is broken!

I then used https://github.com/MihaiValentin/lunr-languages and now I get the same error...

I've got the same error too.

terry47 avatar Apr 09 '19 04:04 terry47

HELP~. I'm confused in which lunr-languages module below is for Elasticlunr ?

https://github.com/weixsong/lunr-languages OR https://github.com/MihaiValentin/lunr-languages

Since weixsong path is broken, I've try MihaiValentin but not working.

TypeError: lunr.generateStopWordFilter is not a function at /home/htdocs/apps/Engine/terry_test/node_modules/lunr-languages/lunr.ru.js:387:35 at Object. (/home/htdocs/apps/Engine/terry_test/elasticlunr.js:5:37) at Module._compile (internal/modules/cjs/loader.js:689:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10) at Module.load (internal/modules/cjs/loader.js:599:32) at tryModuleLoad (internal/modules/cjs/loader.js:538:12) at Function.Module._load (internal/modules/cjs/loader.js:530:3) at Function.Module.runMain (internal/modules/cjs/loader.js:742:12) at startup (internal/bootstrap/node.js:282:19) at bootstrapNodeJSCore (internal/bootstrap/node.js:743:3)

Thanks

terry47 avatar Apr 10 '19 09:04 terry47

sorry for the inconvenience, the repo is recovered. https://github.com/weixsong/lunr-languages

weixsong avatar Apr 11 '19 02:04 weixsong

@weixsong I am trying to use lunr-language-zh which I think support Chinese with elasticlunr, I ran into this same problems.

Can you help?

Also, why not rename it to elasticlunr-languages? I am new to node, I dont know how to change the package.json of eleventy to use your lunr-language instead of the original one

Thank you

kentsin avatar Apr 11 '21 03:04 kentsin