# V1.5.4 bug: When searching in Chinese, it does not work as expected

**URL:** <https://discourse.joplinapp.org/t/v1-5-4-bug-when-searching-in-chinese-it-does-not-work-as-expected/12888>\
**Category:** Support\
**Created:** [5 December 2020 16:02 UTC](https://discourse.joplinapp.org/t/v1-5-4-bug-when-searching-in-chinese-it-does-not-work-as-expected/12888 "2020-12-05T16:02:24Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![s4j4](https://avatars.discourse-cdn.com/v4/letter/s/ecccb3/32.png) [@s4j4](https://discourse.joplinapp.org/u/s4j4)\
**Post date:** [5 December 2020 16:02 UTC](https://discourse.joplinapp.org/t/v1-5-4-bug-when-searching-in-chinese-it-does-not-work-as-expected/12888/1 "2020-12-05T16:02:24Z")

</div>

Using "地球 火星" can not search for "地球 月球 火星" notes.

 ![image](https://canada1.discourse-cdn.com/flex028/uploads/cozic/original/2X/7/7dff7f39aecb2420600c3e5928d6cbe5ce54ebbd.jpeg) ![image](https://canada1.discourse-cdn.com/flex028/uploads/cozic/original/2X/5/5c90cfaaa68c004cdbda14fca8dc92e992ffb391.jpeg)

---

<div class="post-metadata">

**Author:** ![laurent](https://avatars.discourse-cdn.com/v4/letter/l/ce7236/32.png) [@laurent](https://discourse.joplinapp.org/u/laurent)\
**Post date:** [5 December 2020 16:15 UTC](https://discourse.joplinapp.org/t/v1-5-4-bug-when-searching-in-chinese-it-does-not-work-as-expected/12888/2 "2020-12-05T16:15:57Z")

</div>

For Chinese language, only exact matches are supported, so "地球 月球" would work, "月球 火星" too, but not "地球 火星". This is a limitation of the search engine we use (FTS), which is pretty much English language only, although we've improved it to support languages with accentuated characters too. But beyond that, it's not really possible.

---

<div class="post-metadata">

**Author:** ![rxliuli](https://yyz2.discourse-cdn.com/flex028/user_avatar/discourse.joplinapp.org/rxliuli/32/4083_2.png) [@rxliuli](https://discourse.joplinapp.org/u/rxliuli)\
**Post date:** [7 March 2021 03:04 UTC](https://discourse.joplinapp.org/t/v1-5-4-bug-when-searching-in-chinese-it-does-not-work-as-expected/12888/4 "2021-03-07T03:04:53Z")

</div>

But to be honest, Chinese search is still very bad, especially when it contains both Chinese and English. For example, when I enter `Windows 工具清单` but I can’t find the `Windows 上的工具清单`, but it feels like it should be found Yes, this is not right. . .@laurent

---

<div class="post-metadata">

**Author:** ![laurent](https://avatars.discourse-cdn.com/v4/letter/l/ce7236/32.png) [@laurent](https://discourse.joplinapp.org/u/laurent)\
**Post date:** [7 March 2021 17:30 UTC](https://discourse.joplinapp.org/t/v1-5-4-bug-when-searching-in-chinese-it-does-not-work-as-expected/12888/5 "2021-03-07T17:30:01Z")

</div>

I think to properly support Chinese language we would need a special search engine that understands Chinese text. Alphabetical languages have words separated by delimiters like spaces, commas, etc. but Chinese doesn't so we'd need to split `我是法国人` into `我 是 法国人` for instance, but for that the app needs a Chinese dictionary and a special tokenizer.

If someone can create a pull request that solves some of these issues, I'd be willing to help get it done, but it's probably a tricky problem to solve.

---

<div class="post-metadata">

**Author:** ![rxliuli](https://yyz2.discourse-cdn.com/flex028/user_avatar/discourse.joplinapp.org/rxliuli/32/4083_2.png) [@rxliuli](https://discourse.joplinapp.org/u/rxliuli)\
**Post date:** [7 March 2021 23:57 UTC](https://discourse.joplinapp.org/t/v1-5-4-bug-when-searching-in-chinese-it-does-not-work-as-expected/12888/6 "2021-03-07T23:57:53Z")

</div>

Someone has created a related Chinese word segmentation database, but I am not sure how to add it to joplin

> **[yanyiwu/nodejieba](https://github.com/yanyiwu/nodejieba)**
>
> "结巴"中文分词的Node.js版本. Contribute to yanyiwu/nodejieba development by creating an account on GitHub.

---

<div class="post-metadata">

**Author:** ![rxliuli](https://yyz2.discourse-cdn.com/flex028/user_avatar/discourse.joplinapp.org/rxliuli/32/4083_2.png) [@rxliuli](https://discourse.joplinapp.org/u/rxliuli)\
**Post date:** [10 March 2021 13:45 UTC](https://discourse.joplinapp.org/t/v1-5-4-bug-when-searching-in-chinese-it-does-not-work-as-expected/12888/7 "2021-03-10T13:45:27Z")

</div>

So is there any beginning for adding a Chinese word segmentation engine? Or how should I simply add it, right here? @laurent

> <https://github.com/laurent22/joplin/blob/63559ac8b9f6e928f64b1b06e784120929e6a746/packages/lib/services/searchengine/filterParser.ts#L68>

---

<div class="post-metadata">

**Author:** ![rxliuli](https://yyz2.discourse-cdn.com/flex028/user_avatar/discourse.joplinapp.org/rxliuli/32/4083_2.png) [@rxliuli](https://discourse.joplinapp.org/u/rxliuli)\
**Post date:** [10 March 2021 14:14 UTC](https://discourse.joplinapp.org/t/v1-5-4-bug-when-searching-in-chinese-it-does-not-work-as-expected/12888/8 "2021-03-10T14:14:54Z")

</div>

I added a simple example of using stammering to separate Chinese and English words. Of course, this example is very simple, but as long as the Chinese and English are separated and different word segmentation engines are used, it should be able to handle it. @laurent

> <https://github.com/rxliuli/example/blob/d26b6c5a781642394dba841b841b6a95ed203303/jieba-example/src/index.test.ts>

---

<div class="post-metadata">

**Author:** ![laurent](https://avatars.discourse-cdn.com/v4/letter/l/ce7236/32.png) [@laurent](https://discourse.joplinapp.org/u/laurent)\
**Post date:** [10 March 2021 14:41 UTC](https://discourse.joplinapp.org/t/v1-5-4-bug-when-searching-in-chinese-it-does-not-work-as-expected/12888/9 "2021-03-10T14:41:01Z")

</div>

I'm not very familiar with the query parsing code since that was developed by Naveen. How easy is it to integrate your word segmentation code?

---

<div class="post-metadata">

**Author:** ![rxliuli](https://yyz2.discourse-cdn.com/flex028/user_avatar/discourse.joplinapp.org/rxliuli/32/4083_2.png) [@rxliuli](https://discourse.joplinapp.org/u/rxliuli)\
**Post date:** [10 March 2021 15:11 UTC](https://discourse.joplinapp.org/t/v1-5-4-bug-when-searching-in-chinese-it-does-not-work-as-expected/12888/10 "2021-03-10T15:11:06Z")

</div>

Simply put, it is to install an npm package, and then pass in the Chinese paragraph, and the Chinese array after the word segmentation will be returned.  
But it should be noted that since jieba does not support English word segmentation, you have to deal with Chinese and English separately. The example code above does just that.
