Sphinx Coreseek结合MySQL测试
Coreseek搜索测试:MySQL原表结构==>MySQL索引表
第一步:创建测试数据库
create database test charset utf8;
set names utf8; #设置客户端字符集为"utf8"
use test;
create table test_news(
id int primary key auto_increment,
title varchar(255),
content text,
catid smallint
)charset utf8;
desc test_news;
insert into test_news(title,content,catid) values ('北京test网','test网出售thinkpad的笔记本电脑',1);
insert into test_news(title,content,catid) values ('北京天安门好','test网不断录制视频教程,免费开源分享',2);
第二步:设置配置文件
目的:
1、让Sphinx能够正常连接MySQL
2、让Sphinx能够读取数据
3、让Sphinx能生成索引表
修改配置文件:
cd /usr/local/coreseek/etc
cp sphinx.conf.dist csft.conf


第三步:进入coreseek的命令目录,进行"分词测试"
即:cd /usr/local/coreseek/bin
创建索引:./indexer --all
如果报错:
错误1:
/usr/local/coreseek/bin/indexer:error while loading shared libraries:libmysqlclient.so.16 cannot opent shared object file: No such file or directory
这主要是因为你安装库后,没有配置相应的环境变量.可以通过连接修正这个问题
ln -s /usr/local/mysql/lib/libmysqlclient.so.16 /usr/lib/libmysqlclient.so.16
对于64bit Linux,命令为:
ln -s /usr/local/mysql/lib/libmysqlclient.so.16 /usr/lib64/libmysqlclient.so.16
ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib64/libmysqlclient.so.18
错误2:./indexer: error while loading shared libraries: libiconv.so.2: cannot open shared object file: No such file or directory
解决办法如下:
1.在/etc/ld.so.conf中加一行/usr/local/lib,
2.然后运行/sbin/ldconfig,文件解决,没有报错了~~
chmod a+w /usr/local/coreseek/var/data
检索测试:./search thinkpad
./search 北京
结果图

相关推荐
-
PHP8种变量类型的详细讲解2025-02-22 00:32:24
-
php+apache 和 php+nginx的区别2025-02-22 00:21:27
-
PHP:与workerman结合实现定时任务2025-02-22 00:15:57
-
Nginx的Rewrite规则与实例2025-02-22 00:15:39
-
MySql中身份证字段的简单脱敏介绍2025-02-22 00:15:36