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

Add chinese support #53

Merged
merged 2 commits into from
Jun 17, 2021
Merged

Conversation

repairearth
Copy link
Contributor

What i did

  • Add chinese support

Why i did

I looked for the chinese support for lunr, but there was none, so i built it.

It can only run on node side, for browser side, you must first create a serialised index with JSON and load it via

lunr.Index.load(JSON.parse(data))

Here is an example
https://github.com/humanseelabs/gatsby-plugin-lunr/blob/master/src/gatsby-browser.js

I use nodejieba as the chinese tokenizer, and will not want to support other chinese tokenizers, i think nodejieba is good enough.

@danjarvis danjarvis mentioned this pull request May 30, 2019
@dadiorchen
Copy link

Great!
I want to use lunr index Chinese text too, How about the size of the words library?

@repairearth
Copy link
Contributor Author

@dadiorchen Please refer to nodejieba for the detail.

@mapleeit
Copy link

@repairearth Do you have time to solve the conflict so that the owner could merge this? 💐

@repairearth
Copy link
Contributor Author

@mapleeit done.

@mapleeit
Copy link

Hi, @MihaiValentin Please take a look at this PR when you have time. Thanks!

@rapon233
Copy link

感谢!希望能正式实现!
Great job!

@sunzongzheng
Copy link

@repairearth Did you test multiLanguage? I use your repo now. When use single language,it works well. But when use multiLanguage, the search result looks like no word segmentation. I have to search exactly word.
image

@biosocket
Copy link

@repairearth thank you so much for your effort :)

When loading a serialized index as you described, it works, but the segmenter is not loaded. Is there a way to load the segmenter for searching on the browser side?

For example, given the phrase "他们扭头一看"
A search for "他们" returns a result.
A search for "他们扭头一看" returns no result because the segementer is not loaded and the search phrase is not separated into pieces.

@rxliuli
Copy link

rxliuli commented May 2, 2020

Is there any progress in this function?

@futurist
Copy link

futurist commented May 9, 2020

+1 for this PR. Hope it's resolved and merged!

@linhandev
Copy link

Hope Chinese support can be added soon

@LucyGwilliamAdmin
Copy link

@repairearth @MihaiValentin do you know when this might be merged?

Thanks both

@francis-du
Copy link

@repairearth

Hi , Felix:

I think this repo is no longer maintained,.

Can you checkout to this branch ?

@xhemj
Copy link

xhemj commented Sep 12, 2020

终于看到中文的了!希望赶紧合并
Good!!

@su9257
Copy link

su9257 commented Nov 25, 2020

希望支持中文通过

@iansinnott
Copy link

I've recently had success getting lunr working with Chinese manually using the approach described here: https://github.com/stkevintan/hugo-lunr-zh#usage

Even so, it would be great to have Chinese supported via this lib.

@darkyzhou
Copy link

Feeling sad that this PR is still not merged in 2021.

I forked the project and merged this PR into it, as well as publishing a new npm package called lunr-languages-zh for those who are in need of the support for Chinese.

Feel free to inform me if I shouldn't do this... :(

Copy link

@randomJoe211 randomJoe211 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯
Could anybody please merge this PR? Thank you!

@MrAwesome
Copy link

@MihaiValentin can you merge this, or appoint someone to take over merging requests to the repo?

@MihaiValentin MihaiValentin merged commit 1b55cc8 into MihaiValentin:master Jun 17, 2021
@MihaiValentin
Copy link
Owner

Thanks @repairearth for contributing with this!

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

Successfully merging this pull request may close these issues.