MihaiValentin / lunr-languages

A collection of languages stemmers and stopwords for Lunr Javascript library
Other
431 stars 163 forks source link

Connection problem between problemlunr.ja.js tinyseg #42

Open aveclumiere opened 6 years ago

aveclumiere commented 6 years ago

Hi, Thank you for this awesome project!

I'm using lunr with Japanese text, so I write code like this

var lunr = require('lunr');
require('./language/lunr.stemmer.support.js')(lunr);
require('./language/lunr.jp.js')(lunr);

var idx = lunr(function() {
  this.use('lunr.jp');
  this.addField('title');
  this.addField('body');
  this.setRef('id');
})

But when I execute script, error occur with message "TypeError: lunr.TinySegmenter is not a function" I think there are some connection problems between lunr.jp.js and tinyseg.js. I'm not familliar with JS, so I don't know how to fix this problem. Can someone helps me?

myalgo commented 6 years ago

This should help


var lunr = require('lunr');
require('lunr-languages/lunr.stemmer.support')(lunr);
require("lunr-languages/tinyseg")(lunr);
require('lunr-languages/lunr.jp')(lunr); 

var idx = lunr(function() {
  this.use('lunr.jp');
  this.addField('title');
  this.addField('body');
  this.setRef('id');
})