Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
blackwidow207 opened this issue Nov 2, 2022 · 4 comments

Comments

@blackwidow207
Copy link

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 🤣)

@knubie
Copy link

knubie commented Nov 4, 2022

See #45

@blackwidow207
Copy link
Author

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 🤞

@1921Aaron
Copy link

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?

@czy88840616
Copy link

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');

// ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants