# Chinese search doesn't work to some words

**URL:** <https://meta.discourse.org/t/chinese-search-doesnt-work-to-some-words/103815>\
**Category:** Product Support\
**Created:** [December 9, 2018, 10:05am UTC](https://meta.discourse.org/t/chinese-search-doesnt-work-to-some-words/103815 "2018-12-09T10:05:00Z")\
**Posts on this page:** 16\
**Page:** 1

## AI-generated summary

**Chinese search doesn't work to some words**

[Jacky](/t/-/103815/1) reported that some Chinese words cannot be searched on their site and asked for help. [sam](/t/-/103815/2) suggested enabling `search tokenize chinese japanese korean` in site settings and rebuilding the search index. [Stephen](/t/-/103815/4) provided the command to rebuild the search index, and [Jacky](/t/-/103815/5) asked for help with the development environment.

Despite following the instructions, [Jacky](/t/-/103815/7) still encountered issues. [Mittineague](/t/-/103815/8) suspected that the problem might be due to the Chinese locale not being selected. [fantasticfears](/t/-/103815/12) asked [Jacky](/t/-/103815/7) to try enabling `search tokenize chinese japanese korean` and setting the default locale to `zh_CN`. [Jacky](/t/-/103815/13) tried searching on [fantasticfears'](https://master1.discoursecn.org/) site but still encountered issues.

[Jacky](/t/-/103815/16) provided examples of missed search results and suggested that there might be a problem with the search functionality. [fantasticfears](/t/-/103815/14) suspected that the issue might be with the `cppjieba_rb` gem and suggested updating it to version 0.3.3.

<div class="post-metadata">

**Author:** ![Jacky](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jacky/32/293257_2.png) [@Jacky](https://meta.discourse.org/u/Jacky)\
**Post date:** [December 9, 2018, 10:05am UTC](https://meta.discourse.org/t/chinese-search-doesnt-work-to-some-words/103815/1 "2018-12-09T10:05:00Z")

</div>

Hi all,  
I find that some Chinese words cannot be searched. I don’t know why. Any idea for that?

The screenshot below comes from this site. You can view it from [https://meta.discourse.org/t/discourse/6780?source\_topic\_id=13287](https://meta.discourse.org/t/discourse/6780?source_topic_id=13287)

 ![t](https://global.discourse-cdn.com/meta/original/3X/a/9/a9a23edd078831cefa7a377f9e9f0c6ec274cdbd.png)

---

<div class="post-metadata">

**Author:** ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)\
**Post date:** [December 11, 2018, 11:53pm UTC](https://meta.discourse.org/t/chinese-search-doesnt-work-to-some-words/103815/2 "2018-12-11T23:53:33Z")

</div>

You have to enable `search tokenize chinese japanese korean` in site settings and rebuild the search index by editing the post or something.

This should be enabled by default for you in site settings if you have Chinese locale selected.

---

<div class="post-metadata">

**Author:** ![Jacky](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jacky/32/293257_2.png) [@Jacky](https://meta.discourse.org/u/Jacky)\
**Post date:** [December 12, 2018, 9:18am UTC](https://meta.discourse.org/t/chinese-search-doesnt-work-to-some-words/103815/3 "2018-12-12T09:18:58Z")

</div>

Thanks Sam. I’m not sure how to rebuild the search index, I will do some research on it. Thanks

---

<div class="post-metadata">

**Author:** ![Stephen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/stephen/32/95011_2.png) [@Stephen](https://meta.discourse.org/u/Stephen)\
**Post date:** [December 12, 2018, 9:23am UTC](https://meta.discourse.org/t/chinese-search-doesnt-work-to-some-words/103815/4 "2018-12-12T09:23:03Z")

</div>

If memory serves:

```
cd /var/discourse
./launcher enter app
rake search:reindex

```

---

<div class="post-metadata">

**Author:** ![Jacky](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jacky/32/293257_2.png) [@Jacky](https://meta.discourse.org/u/Jacky)\
**Post date:** [December 12, 2018, 9:25am UTC](https://meta.discourse.org/t/chinese-search-doesnt-work-to-some-words/103815/5 "2018-12-12T09:25:09Z")

</div>

Thanks Stephen. Do you know how to do it under development environment?

---

<div class="post-metadata">

**Author:** ![Stephen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/stephen/32/95011_2.png) [@Stephen](https://meta.discourse.org/u/Stephen)\
**Post date:** [December 12, 2018, 9:29am UTC](https://meta.discourse.org/t/chinese-search-doesnt-work-to-some-words/103815/6 "2018-12-12T09:29:25Z")

</div>

You can run rake from `./bin/docker`

I can’t be more specific without details of your dev environment install.

---

<div class="post-metadata">

**Author:** ![Jacky](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jacky/32/293257_2.png) [@Jacky](https://meta.discourse.org/u/Jacky)\
**Post date:** [December 12, 2018, 12:37pm UTC](https://meta.discourse.org/t/chinese-search-doesnt-work-to-some-words/103815/7 "2018-12-12T12:37:56Z")

</div>

It still doesn’t work on my dirsource.  
I find an example from this site:  
[https://meta.discourse.org/t/discourse/6780?source\_topic\_id=13287](https://meta.discourse.org/t/discourse/6780?source_topic_id=13287)

You can find some Chinese words from the topic above, but if you search some of these words, it shows no results.

 ![t](https://global.discourse-cdn.com/meta/original/3X/6/5/651c9b8402162dd4d8ea7e16669070a743203ba8.png)

---

<div class="post-metadata">

**Author:** ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)\
**Post date:** [December 12, 2018, 8:38pm UTC](https://meta.discourse.org/t/chinese-search-doesnt-work-to-some-words/103815/8 "2018-12-12T20:38:49Z")

</div>

Going by the text as it appears in the screen captures, it looks like missed

> [@sam](#):
>
> have Chinese locale selected.

---

<div class="post-metadata">

**Author:** ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)\
**Post date:** [December 12, 2018, 9:12pm UTC](https://meta.discourse.org/t/chinese-search-doesnt-work-to-some-words/103815/9 "2018-12-12T21:12:29Z")

</div>

@fantasticfears any tips here? Is the segmenter broken here?

---

<div class="post-metadata">

**Author:** ![Jacky](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jacky/32/293257_2.png) [@Jacky](https://meta.discourse.org/u/Jacky)\
**Post date:** [December 13, 2018, 12:59am UTC](https://meta.discourse.org/t/chinese-search-doesnt-work-to-some-words/103815/10 "2018-12-13T00:59:58Z")

</div>

This screen capture can be clearer.

 ![t](https://global.discourse-cdn.com/meta/original/3X/a/9/a9a23edd078831cefa7a377f9e9f0c6ec274cdbd.png)

---

<div class="post-metadata">

**Author:** ![Jacky](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jacky/32/293257_2.png) [@Jacky](https://meta.discourse.org/u/Jacky)\
**Post date:** [December 13, 2018, 11:24am UTC](https://meta.discourse.org/t/chinese-search-doesnt-work-to-some-words/103815/11 "2018-12-13T11:24:12Z")

</div>

![t](https://global.discourse-cdn.com/meta/original/3X/8/0/80c4276d603e95451535f171f8f3098c9d3ae706.png)

---

<div class="post-metadata">

**Author:** ![fantasticfears](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fantasticfears/32/119608_2.png) [@fantasticfears](https://meta.discourse.org/u/fantasticfears)\
**Post date:** [December 13, 2018, 9:29pm UTC](https://meta.discourse.org/t/chinese-search-doesnt-work-to-some-words/103815/12 "2018-12-13T21:29:54Z")

</div>

Do you enable the `search tokenize chinese japanese korean`? Or do you set `default locale` as `zh_CN`? Meta probably didn’t enable those settings. Mind trying something here? [https://master1.discoursecn.org/](https://master1.discoursecn.org/)

@sam Segmenter works for me. It should be something else.

---

<div class="post-metadata">

**Author:** ![Jacky](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jacky/32/293257_2.png) [@Jacky](https://meta.discourse.org/u/Jacky)\
**Post date:** [December 13, 2018, 10:11pm UTC](https://meta.discourse.org/t/chinese-search-doesnt-work-to-some-words/103815/13 "2018-12-13T22:11:30Z")

</div>

I tried some words on your site. It still doesn’t work

 ![t](https://global.discourse-cdn.com/meta/original/3X/2/8/2872d038b192617e71b93996ef5e0e023c0657f0.png)

It can be seen from the screenshot below that the provided results do not include the current topic that I was viewing, but it should include. It cannot cover all correct results.

 ![t2](https://global.discourse-cdn.com/meta/original/3X/1/f/1f6e7b23259aa54951f7e232bb26cb982f752f6a.png)

---

<div class="post-metadata">

**Author:** ![fantasticfears](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fantasticfears/32/119608_2.png) [@fantasticfears](https://meta.discourse.org/u/fantasticfears)\
**Post date:** [December 13, 2018, 11:22pm UTC](https://meta.discourse.org/t/chinese-search-doesnt-work-to-some-words/103815/14 "2018-12-13T23:22:10Z")

</div>

I’m not really sure which is broken since both text come back with expected segmentation.

Can you update `cppjieba_rb` to 0.3.3? @sam

---

<div class="post-metadata">

**Author:** ![Jacky](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jacky/32/293257_2.png) [@Jacky](https://meta.discourse.org/u/Jacky)\
**Post date:** [December 14, 2018, 11:43am UTC](https://meta.discourse.org/t/chinese-search-doesnt-work-to-some-words/103815/16 "2018-12-14T11:43:41Z")

</div>

I am pasting some missed words here. If you copy them and search for them in Discourse, you will find that the expected search results are missing.

For this site: (the results should include this page: [https://meta.discourse.org/t/discourse/6780?source\_topic\_id=13287](https://meta.discourse.org/t/discourse/6780?source_topic_id=13287))  
Guide Release

For Erick Guan’s site ([https://master1.discoursecn.org/](https://master1.discoursecn.org/))  
Restart Server (search results should include: [https://meta.discoursecn.org/t/topic/2510](https://meta.discoursecn.org/t/topic/2510))

---

<div class="post-metadata">

**Author:** ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)\
**Post date:** [October 31, 2021, 3:47am UTC](https://meta.discourse.org/t/chinese-search-doesnt-work-to-some-words/103815/17 "2021-10-31T03:47:33Z")

</div>

Automatically bumped on October 31, 2021, 3:47am UTC


