MihaiValentin/lunr-languages

Search indexing for Chinese language (lunr.zh) does not work with multi-language

blackwidow207 opened this issue · 4 comments

lunr.zh handles things a little differently for spaces, so when used with another language for multi-language support the words in a sentence are all thrown together into a single indexed term, so users cannot search for a word.
(Bonus feature searching for an entire sentence works though 🤣)

See #45

See #45

Thanks! I will give it a try.
I expanded on the existing unit tests for multi language testing and found the same issue with Japanese Thai and Chinese, hopefully this will solve it for all 3 🤞

See #45

Thanks! I will give it a try. I expanded on the existing unit tests for multi language testing and found the same issue with Japanese Thai and Chinese, hopefully this will solve it for all 3 🤞

Is it resolved?

just use it, works well.

  this.use(lunr.multiLanguage('en', 'zh'));
  this.tokenizer = function (x) {
    return lunr.tokenizer(x).concat(lunr.zh.tokenizer(x));
  };

  this.ref('id');
  this.field('title');
  this.field('body');

// ...