Skip to content Skip to sidebar Skip to footer

Why No Search Result For The Cjk(chinese) Word In Python's Documentation Generator--sphinx Search Bar?

I build a simple project which contain only one article,the title is yahoo股票历史数据下载,and the file yahoo股票历史数据下载.rst,only contain one sentence 问题:

Solution 1:

To install jieba lib.

sudo pip install jieba

To locate the jieba dictionary file.

sudo find /usr   -name  "jieba"
/usr/local/lib/python3.5/dist-packages/jieba
ls  /usr/local/lib/python3.5/dist-packages/jieba
analyse     dict.txt  __init__.py  posseg
_compat.py  finalseg  __main__.py  __pycache__

The jieba dictionary file located in /usr/local/lib/python3.5/dist-packages/jieba/dict.txt.

To edit sphinx's conf.py.

vim source/conf.py 
html_search_language = 'zh'
html_search_options = {'dict': '/usr/local/lib/python3.5/dist-packages/jieba/dict.txt'} 

To recompile all files in your project directory.

cd  yourproject
make html

To restart apache2.

sudo systemctl restart apache2 #maybe it is not neccessary.

Now chinese characters can be searched.

Post a Comment for "Why No Search Result For The Cjk(chinese) Word In Python's Documentation Generator--sphinx Search Bar?"