weixsong / elasticlunr.js

Based on lunr.js, but more flexible and customized.
http://elasticlunr.com
MIT License
2.03k stars 148 forks source link

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

Open farhat-h opened 6 years ago

farhat-h commented 6 years ago

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

ToLuSt commented 6 years ago

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.

farhat-h commented 6 years ago

Indeed, thanks for the help :+1:

gmmarc commented 6 years ago

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

kaijauk commented 5 years ago

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...

lucagentile commented 5 years ago

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.

terry47 commented 5 years ago

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 commented 5 years ago

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

weixsong commented 5 years ago

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

kentsin commented 3 years ago

@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