dipus是一个简单的全文搜索服务器,使用whoosh for sphinx
dipus的Python项目详细描述
dipus是一个使用Whoosh的简单全文搜索服务器。狄普斯是 集成到Sphinx document builder。
您可以用n-gram快速搜索文档。
如何安装
% pip install dipus
依赖性
- python 2.7版
- 斯芬克斯
- 呜呜
- simplejson
- 瓶子
如何使用
启动dipus服务器
python -m dipus.websetup -c conf.json
conf.json示例
{ "indexroot": "/path/to/index" }
dipus服务器的默认url是“http://0.0.0.0:9876”。
注册sphinx文档
- 在conf.py中添加扩展名
extensions = ['dipus.dipusbuilder']and there are optional settings.
#dipus_server_url = "http://192.0.2.20" # url of dipus server # Default is "http://localhost:9876" #dipus_index = "test_rst" # identifier of this document # Default is same as 'project' in conf.py
运行生成器
% sphinx-build -b dipus source build
警告:生成器将覆盖\u static/search_dipus.js和模板/search_dipus.html。
复制搜索文件
注意:当您更改conf.py dipus相关值后,需要一次。
% cp _template/search_dipus.html _template/search.html
如果您已经创建了自己的search.html,请将其合并。
像往常一样制作HTML
% make html
关于构建器的注释将很快完成,如“火和忘记”。但是 服务器上的索引本身不是那么快。请耐心等待 所有文档都将被编入索引。
(可选)将dipus builder添加到makefile
在makefile的html部分添加调用dipus builder的行 作为打击。
html: $(SPHINXBUILD) -b dipus $(ALLSPHINXOPTS) $(BUILDDIR)/html $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html Then, whenever type 'make html', documents are registerd.
从Sphinx文档搜索
只需打开搜索框并键入。
要求
- python 2.7(抱歉,目前不是3)
- 斯芬克斯
- 呜呜
- simplejson
- 瓶子
安全性
dipus仅供内部使用。
如果你想在公众场合使用,请使用谷歌。
待办事项
- 测试测试
- 安全性
- Python3
- 管理屏幕
- 正确突出显示搜索结果(也称为片段)
- 日志记录
- 搜索多个文档
- 由每个文档选择的分析器