把安装包解压到 D:coreseek
创建表
create table product( id int key auto_increment,
title varchar(255),
content text
);
insert into product(title,content) values
('苹果电脑1','苹果电脑很好1'),
('苹果电脑2','苹果电脑很好2'),
('苹果笔记本1','苹果笔记本很好1'),
('山西苹果','山西苹果好吃'),
('dell电脑','苹果电脑很好1'),
('联想电脑1','联想电脑很好1');
配置文件
#源定义 设置数据来源
source mysql
{
type = mysql
sql_host = localhost
sql_user = root
sql_pass =
sql_db = system
sql_port = 3306
sql_query_pre = SET NAMES utf8
sql_query = select id,title,content from product
} #index定义 设置索引
index index1
{
source = mysql
path = D:/coreseek/var/data/mysql
docinfo = extern
mlock = 0
morphology = none
min_word_len = 1
html_strip = 0 charset_dictpath = D:/coreseek/etc/
charset_type = zh_cn.utf-8
} #全局index定义
indexer
{
mem_limit = 128M
} #searchd服务定义
searchd
{
listen = 9312
read_timeout = 5
max_children = 30
max_matches = 1000
seamless_rotate = 0
preopen_indexes = 0
unlink_old = 1
pid_file=D:/coreseek/var/log/searchd_mysql.pid
log=D:/coreseek/var/log/searchd_mysql.log
query_log=D:/coreseek/var/log/query_mysql.log }
创建索引
D:/coreseek,执行:bin\indexer -c etc\csft_mysql.conf --all
安装服务
bin\searchd --install --config d:/coreseek/etc/csft_mysql.conf
安装成功后命令行窗口会提示"services searchd installed successfully"。
删除服务
sc delete +服务名称
sc delete searchd