1:下载地址http://download.csdn.net/download/dongmelon/10137926 资源我放在csdn
2:解压之后改个名字(sphinx),便于管理
3:将D:\sphinx\sphinx.conf.in复制到D:\sphinx\bin\sphinx.conf.in,并重命名为sphinx.conf; //这个是写配置文件。
4:更改默认的配置文件信息source src1的配置信息
sql_host = localhost
sql_user = root
sql_pass =
sql_db = test //这里指定数据库,先自己跑的试一下就用默认的。这是参数都可以改的。
sql_port = 3306 # optional, default is 3306
sql_query_pre = SET NAMES utf-8 # 设置编码,如果用的是utf-8编码
charset_table = 0..9, A..Z->a..z, _, a..z, U+410..U+42F->U+430..U+44F, U+430..U+44F # 指定utf-8编码表
seamless_rotate = 1 #windows下这个一定要是1
5:改index test1 的索引信息
path = D:/sphinx/data/ # 放索引的目录
charset_type = utf-8
ngram_len = 1 # 简单分词,只有0和1,需要搜索中文必须置1
ngram_chars = U+3000..U+2FA1F # 需要分词的字符,搜索中文时必须
6:导入测试数据将D:\sphinx\example.sql中语句执行到test数据库中,注意:test数据库创建时需要指定为utf-8格式;
7:建立索引
打开cmd窗口,进入目录D:\sphinx\bin;
执行indexer.exe test1,test1即为sphinx.conf中index test1
Sphinx 2.0.6-id64-release (r3473) Copyright (c) 2001-2012, Andrew Aksyonoff Copyright (c) 2008-2012, Sphinx Technologies Inc (http://sphin
using config file './sphinx.conf'... indexing index 'test1'... collected 4 docs, 0.0 MB sorted 0.0 Mhits, 100.0% done total 4 docs, 222 bytes total 0.019 sec, 11252 bytes/sec, 202.74 docs/sec total 2 reads, 0.000 sec, 0.2 kb/call avg, 0.0 msec/call avg total 9 writes, 0.000 sec, 0.1 kb/call avg, 0.0 msec/call avg
8:配置log等文件
pid_file=D:/sphinx/log/searchd.pid
log=D:/sphinx/log/searchd.log
query_log=D:/sphinx/log/query.log
9:启动服务。
执行命令searchd.exe --pidfile 启动服务,关闭cmd就停止了
启动的时候会出错:index 'test1stemmed': search error: failed to open D:/sphinx/data/test1stemmed.s ph: No such file or directory.
这个找不出原因:都说不管他
10:注意,有些警告就不去管他。因为不清楚。
11:做成widnwos服务
C:\Sphinx\bin> C:\Sphinx\bin\searchd --install --config C:\Sphinx\sphinx.conf.in --servicename SphinxSearch
相关链接:http://blog.csdn.net/phachon/article/details/52450970
http://blog.csdn.net/youmengdaigu/article/details/45824163
http://blog.csdn.net/qq_34812960/article/details/78040522
https://www.cnblogs.com/findgor/p/5644540.html
官方文档: http://sphinxsearch.com/docs/current.html#installing-windows