php+ mysql+coreseek建立中文搜索引擎

来源:互联网 发布:validform.js ajaxurl 编辑:程序博客网 时间:2024/06/03 20:55

1:首先到官网下载coreseek4.1 windows 版本 http://www.coreseek.cn
2:解压到磁盘:我这里解压到D盘
3:复制D:/coreseek/etc/csft_mysql.conf   文件 到 D:/coreseek/bin  里面 重新命名为coreseek.conf 到编辑器打开配置文件
4:配置如下:
#数据源定义
source mysql{
    type                    = mysql
    sql_host                = localhost
    sql_user                = root
    sql_pass                = root
    sql_db                  = cms20131115
    sql_port                = 3306
    sql_query_pre           = SET NAMES utf8
    sql_query               = SELECT searchid, adddate, catid, id, modelid, data as content FROM think_search
                                                              #sql_query第一列id需为整数
                                                              #title、content作为字符串/文本字段,被全文索引
    sql_attr_uint           = id      #从SQL读取到的值必须为整数
    sql_attr_uint           = modelid
    sql_attr_uint           = catid
    sql_attr_timestamp      = adddate #从SQL读取到的值必须为整数,作为时间属性
    sql_query_info_pre      = SET NAMES utf8                                        #命令行查询时,设置正确的字符集
    sql_query_info          = SELECT * FROM think_search WHERE searchid=$id #命令行查询时,从数据库读取原始数据信息
}
#索引定义
index mysql
{
    source           = mysql #对应的source名称
    path             = D:/coreseek/var/data/mysql #请修改为实际使用的绝对路径,例如:/usr/local/coreseek/var/...
    docinfo          = extern
    mlock            = 0
    morphology       = none
    min_word_len     = 1
    html_strip       = 0
    #中文分词配置,详情请查看:http://www.coreseek.cn/products-install/coreseek_mmseg/
    #charset_dictpath = /usr/local/mmseg3/etc/ #BSD、Linux环境下设置,/符号结尾
    charset_dictpath = D:/coreseek/etc/ #Windows环境下设置,/符号结尾,最好给出绝对路径,例如:C:/usr/local/coreseek/etc/...
    charset_type     = zh_cn.utf-8
}
#全局索引定义
indexer
{
    mem_limit       = 128M
}
#搜索服务定义
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  #请修改为实际使用的绝对路径,例如:/usr/local/coreseek/var/...
    log         = D:/coreseek/var/log/searchd_mysql.log #请修改为实际使用的绝对路径,例如:/usr/local/coreseek/var/...
    query_log   = D:/coreseek/var/log/query_mysql.log #请修改为实际使用的绝对路径,例如:/usr/local/coreseek/var/...
    binlog_path =  #关闭binlog日志
}




5:cmd运行


6:安装coreseek服务


     D:/coreseek/bin/searchd --install --config D:/coreseek/bin/coreseek.conf  --servicename Coreseek


7:启动coreseek
       scstart Coreseek 
8:更新索引
       D:/coreseek/bin/indexer -c D:/coreseek/bin/coreseek.conf --all --rotate
9:开始coreseek
       D:/coreseek/bin/searchd -c D:/coreseek/bin/coreseek.conf


10:可以在页面测试了
   




11:如果要停止服务:
12:停止服务
        sc stop Coreseek
13:卸载
        sc delete Coreseek
     

0 0
原创粉丝点击