问题
I build a simple project which contain only one article,the title is yahoo股票历史数据下载
,and the file yahoo股票历史数据下载.rst
,only contain one sentence 问题:为何可以通过浏览器下载yahoo股票历史数据,无法使用wget curl下载?
String in english can be searched.
To search cjk(chinese) word "股票" with grep command.
grep -n -r "股票" myproject
/source/research/yahoo股票历史数据下载.rst:yahoo股票历史数据下载
/source/research/yahoo股票历史数据下载.rst:问题:为何可以通过浏览器下载yahoo股票历史数据,无法使用wget curl下载?
/build/html/research/yahoo股票历史数据下载.html: <title>1. yahoo股票历史数据下载 — documents 1 documentation</title>
/build/html/research/yahoo股票历史数据下载.html:<h1>1. yahoo股票历史数据下载<a class="headerlink" href="#yahoo" title="Permalink to this headline">¶</a></h1>
/build/html/research/yahoo股票历史数据下载.html:<p>问题:为何可以通过浏览器下载yahoo股票历史数据,无法使用wget curl下载?</p>
/build/html/research/yahoo股票历史数据下载.html:<li class="toctree-l1 current"><a class="current reference internal" href="#">1. yahoo股票历史数据下载</a></li>
/build/html/research/yahoo股票历史数据下载.html: <a href="../_sources/research/yahoo股票历史数据下载.rst.txt"
To search cjk(chinese) word "股票" in the python's documentation generator--sphinx search bar.
You can see that yahoo
is the first word both in the title and in the content,the second word both in the title and in the content is the target 股票
to be searched.
Why your search did not match any documents?
回答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.
来源:https://stackoverflow.com/questions/57221406/why-no-search-result-for-the-cjkchinese-word-in-pythons-documentation-generat