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

WBOY
Freigeben: 2016-07-29 08:53:52
Original
1319 Leute haben es durchsucht

在我们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用法

    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教程有兴趣的朋友有所帮助。

Verwandte Etiketten:
Quelle:php.cn
Erklärung dieser Website
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage
Über uns Haftungsausschluss Sitemap
Chinesische PHP-Website:Online-PHP-Schulung für das Gemeinwohl,Helfen Sie PHP-Lernenden, sich schnell weiterzuentwickeln!