学习sphinx sphinx 中文 django sphinx python sphinx用法

php中文网
发布: 2016-07-29 08:53:52
原创
1617人浏览过

在我们php开发中如何使用sphinx技术?

答:对应MySQL数据库中的字段,就是将字段中的中文信息拆分成多个词语,然后对这些词语建立索引。以后查询的时候,先去查询这些索引文件,然后返回这些满足条件的记录的主键id,然后根据主键id查询MySQL数据库,返回记录。

sphinx 文档,sphinx 安装,sphinx cat,sphinx doc,sphinx 中文,django sphinx,python sphinx用法

什么是sphinx?(百度百科)

注意:对于sphinx来说,单表千万条记录,响应的时间都是毫秒级别的。

sphinx 文档,sphinx 安装,sphinx cat,sphinx doc,sphinx 中文,django sphinx,python sphinx用法

注意:默认sphinx只支持英文和俄文

官网:

http://sphinxsearch.com/

由于Sphinx只支持以上两种语言,所以有第三方公司为sphinx开发了中分分词包,叫做coreseek

官网:

http://www.coreseek.cn/

sphinx 文档,sphinx 安装,sphinx cat,sphinx doc,sphinx 中文,django sphinx,python sphinx用法

客户案例:http://www.coreseek.cn/products/ft_powered/

注意两点:

  1. sphinx是一个全文搜索引擎,只支持俄文和英文

  2. 由于上面的原因,有专门的公司为其开发了中文分词包,叫做coresesk。

  3. 中国有一家做的比较好的公司(海量分词)

    http://www.hylanda.com/

    故事:http://home.hylanda.com/show_5_19.html

    sphinx 文档,sphinx 安装,sphinx cat,sphinx doc,sphinx 中文,django sphinx,python sphinx用法

    实操

  4. 下载

    sphinx 文档,sphinx 安装,sphinx cat,sphinx doc,sphinx 中文,django sphinx,python sphinx用法

    立即学习Python免费学习笔记(深入)”;

    2. 构建一个大数据的表(歌词表)

    mysql > source d:/songs.sql

    文件目录:

    sphinx 文档,sphinx 安装,sphinx cat,sphinx doc,sphinx 中文,django sphinx,python sphinx用法命令:

    sphinx 文档,sphinx 安装,sphinx cat,sphinx doc,sphinx 中文,django sphinx,python sphinx用法

    sphinx安装-使用

    安装

    千万注意:sphinx的配置文件一定不能使用Windows的记事本打开。(BOM头)

    sphinx 文档,sphinx 安装,sphinx cat,sphinx doc,sphinx 中文,django sphinx,python sphinx用法

    API接口文件:可以用php调用该接口去操作sphinx服务器端的索引文件。

    sphinx 文档,sphinx 安装,sphinx cat,sphinx doc,sphinx 中文,django sphinx,python sphinx用法

  5. 修改配置文件

    sphinx 文档,sphinx 安装,sphinx cat,sphinx doc,sphinx 中文,django sphinx,python sphinx用法

    索引文件

    sphinx 文档,sphinx 安装,sphinx cat,sphinx doc,sphinx 中文,django sphinx,python sphinx用法

    内存设置:

    sphinx 文档,sphinx 安装,sphinx cat,sphinx doc,sphinx 中文,django sphinx,python sphinx用法

    sphinxd配置:

    sphinx 文档,sphinx 安装,sphinx cat,sphinx doc,sphinx 中文,django sphinx,python sphinx用法

  6. 建立索引

    sphinx 文档,sphinx 安装,sphinx cat,sphinx doc,sphinx 中文,django sphinx,python sphinx用法

    配置文件中index后面的名称

    sphinx 文档,sphinx 安装,sphinx cat,sphinx doc,sphinx 中文,django sphinx,python sphinx用法

    建立索引后的目录结构

    sphinx 文档,sphinx 安装,sphinx cat,sphinx doc,sphinx 中文,django sphinx,python sphinx用法

    3. 实际使用

    a. 开启sphinx的服务,可以使用帮助信息查看如何使用

    sphinx 文档,sphinx 安装,sphinx cat,sphinx doc,sphinx 中文,django sphinx,python sphinx用法

    使用:

  7. 可以单独的读取配置文件运行

  8. 也可以安装成Windows的一个系统服务来运行

    sphinx 文档,sphinx 安装,sphinx cat,sphinx doc,sphinx 中文,django sphinx,python sphinx用法

    启动sphinx服务(读取配置文件单次启动)

    sphinx 文档,sphinx 安装,sphinx cat,sphinx doc,sphinx 中文,django sphinx,python sphinx用法

    定义为系统服务后(安装)

    sphinx 文档,sphinx 安装,sphinx cat,sphinx doc,sphinx 中文,django sphinx,python sphinx用法

    使用

    1. 具体使用(sphinx流程可以见下图)

    sphinx流程图:

    sphinx存储引擎:通过下面的步骤发现,发现php程序在做查询的时候,必须先根据sphinx服务器返回主键ID,然后根据主键ID去查询MySQL数据库,最后返回数据库。

    这个时候,可以这样思考,将sphinx作为MySQL的一个存储引擎使用,这个时候php程序就可以直接的去连接MySQL服务器,MySQL服务器去自身的sphinx存储引擎里面获取分词后的数据。不需要连接一次sphinx服务器了。这个存储引擎叫做sphinxSE。

    http://blog.csdn.net/uestc_huan/article/details/6395145

    sphinx 文档,sphinx 安装,sphinx cat,sphinx doc,sphinx 中文,django sphinx,python sphinx用法

  9. 简单使用

    sphinx 文档,sphinx 安装,sphinx cat,sphinx doc,sphinx 中文,django sphinx,python sphinx用法

  10. 使用

    sphinx 文档,sphinx 安装,sphinx cat,sphinx doc,sphinx 中文,django sphinx,python sphinx用法

    sphinx 文档,sphinx 安装,sphinx cat,sphinx doc,sphinx 中文,django sphinx,python sphinx用法

以上就介绍了学习sphinx,包括了sphinx方面的内容,希望对PHP教程有兴趣的朋友有所帮助。

python速学教程(入门到精通)
python速学教程(入门到精通)

python怎么学习?python怎么入门?python在哪学?python怎么学才快?不用担心,这里为大家提供了python速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!

下载
来源:php中文网
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
开源免费商场系统广告
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号