sphinx官网下载页面(点这里)cd /usr/local/src/
wget http://sphinxsearch.com/files/sphinx-3.2.1-f152e0b-linux-amd64-glibc2.12.tar.gz
//解压
tar sphinx-3.2.1-f152e0b-linux-amd64-glibc2.12.tar.gz
//建立软链
$ ln -s /usr/local/sphinx-3.2.1 /app/sphinx
//复制一个配置文件
cp /app/sphinx/etc/sphinx-mini.conf.dist /application/sphinx/etc/test.conf
//编辑配置文件
vim /app/sphinx/etc/test.conf
导入示例数据> mysql -h127.0.0.1 -uroot -p < example.sql
> 输入数据库密码
mysql> use test
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
+----------------+
| Tables_in_test |
+----------------+
| documents |
| tags |
+----------------+
mysql> select * from documents;
+----+----------+-----------+---------------------+-----------------+--------------------------------------------------------+
| id | group_id | group_id2 | date_added | title | content |
+----+----------+-----------+---------------------+-----------------+--------------------------------------------------------+
| 1 | 1 | 5 | 2020-06-29 17:03:39 | test one | this is my test document number one. also phrases. |
| 2 | 1 | 6 | 2020-06-29 17:03:39 | test two | this is my test document number two |
| 3 | 2 | 7 | 2020-06-29 17:03:39 | another doc | this is another group |
| 4 | 2 | 8 | 2020-06-29 17:03:39 | doc number four | this is to test groups |
+----+----------+-----------+---------------------+-----------------+--------------------------------------------------------+
测试配置> ./bin/indexer --config etc/sphinx.conf
Sphinx 3.2.1 (commit f152e0b)
Copyright (c) 2001-2020, Andrew Aksyonoff
Copyright (c) 2008-2016, Sphinx Technologies Inc (http://sphinxsearch.com)
ERROR: nothing to do.
如未成功或提示此段错误ERROR: index 'test1': sql_connect: failed to load libmysqlclient (or libmariadb) (DSN=mysql://root:***@localhost:3306/test).
安装(仅适用于centos)yum install mysql-devel.x86_64
生成索引数据./bin/searchd --config etc/sphinx.conf
停止服务killall searchd
重新生成testindex索引数据$./bin/indexer testindex --config etc/sphinx.conf --rotate
//重新生成全部索引
./bin/indexer --all --config etc/sphinx.conf --rotate
搜狗词库(点这里)