sphinx的配置
sphinx
 
	主中文分词,是要安装coreseek插件的,相关的配置在/usr/local/coreseek/etc/csft.conf中进行配置的
开头 source xxx{  //这是源  xxx可以任意指定,要注意上下的关联
type = mysql //指定数据库类型
    sql_host                = xxxxxx
    sql_user                = xxxxxx
    sql_pass                = xxxxxx
    sql_db                    = xxxxxx
    sql_port                = 3306    # optional, default is 3306
sql_sock = /tmp/mysql.sock
    sql_query_pre            = SET NAMES utf8 //设置编码
    sql_query_pre            = SET SESSION query_cache_type=OFF //关闭缓存
    sql_query_pre           = REPLACE INTO `计数表` select 1,max(id) from 索引表   //增量索引的时候必须设置
sql_query=SELECT id, name FROM 索引表 where id<=(select max_id from 计数表 where 计数表.id=1) //增量索引的
时候必须设置
sql_ranged_throttle = 0
sql_query_info = SELECT * FROM `索引表` WHERE id=$id
    
}
增量索引
source z(增量索引名称,可以自行定义,注意上下关联) : xxx(继承源的名称)
{
    sql_query_pre= set names utf8
    sql_query=select id,name from 索引源 where id >(select max_id from 计数表 where id = 1)
}
index xxx{ //源索引,注意上下名称
source = xxx 指定源
path = /usr/local/sphinx/var/data/main /指定缓存路径
    charset_type        = zh_cn.utf-8 //编码
    charset_dictpath = /usr/local/mmseg/etc/  引入字典
    //其余不用管它,好吧,主要是还没研究到具体用途...   
}
index z : xxx   //定义增量索引数据存储路径
{
    source = delta
    path            = /usr/local/sphinx/var/data/delta
}
indexer   //公共配置
{ 
mem_limit = 128M
}
searchd{
log = /usr/local/sphinx/var/log/searchd.log
        query_log            = /usr/local/sphinx/var/log/query.log
        read_timeout        = 5 
        一般不用管它
}
sphinx主要就是配置文件和安装麻烦,把这些都搞定了的话,基本上拿起来就可以用了。配置文件中的一些参数回头有时间好好研究一下究竟是做什么用的。
