🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
1.配置文件 ~~~ #MySQL数据源配置,详情请查看:http://www.coreseek.cn/products-install/mysql/ #请先将var/test/documents.sql导入数据库,并配置好以下的MySQL用户密码数据库 #源定义 source mysql { type = mysql sql_host = localhost sql_user = root sql_pass = 123456 sql_db =test sql_port = 3307 sql_query_pre = SET NAMES utf8 sql_query_pre = REPLACE INTO sph_counter SELECT 1,MAX(id) FROM documents sql_query = SELECT id, title,create_time, content FROM documents \ WHERE id<=( SELECT max_doc_id FROM sph_counter WHERE counter_id=1 ) sql_attr_timestamp = create_time #从SQL读取到的值必须为整数,作为时间属性 } source delta:mysql {#这里是新增的增量索引源 sql_query_pre = SET NAMES utf8 sql_query = SELECT id, title,create_time, content FROM documents \ WHERE id>( SELECT max_doc_id FROM sph_counter WHERE counter_id=1 ) #sql_query_post_index = replace into sph_counter select 1,max(id) from picture_info } #index定义 index mysql { source = mysql #对应的source名称 path = D:/SOFT_PHP_PACKAGE/search/yzdd/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:/SOFT_PHP_PACKAGE/search/yzdd/coreseek/etc/ #Windows环境下设置,/符号结尾,最好给出绝对路径,例如:C:/usr/local/coreseek/etc/... charset_type = zh_cn.utf-8 } index delta:mysql {#这是新增的增量索引 source = delta path = D:/SOFT_PHP_PACKAGE/search/yzdd/coreseek/var/data/delta } #全局index定义 indexer { mem_limit = 128M } #searchd服务定义 searchd { listen = 9312 read_timeout = 5 max_children = 30 max_matches = 1000 seamless_rotate = 0 preopen_indexes = 0 compat_sphinxql_magics = 0 unlink_old = 1 pid_file = D:/SOFT_PHP_PACKAGE/search/yzdd/coreseek/var/log/searchd_mysql.pid #请修改为实际使用的绝对路径,例如:/usr/local/coreseek/var/... log = D:/SOFT_PHP_PACKAGE/search/yzdd/coreseek/var/log/searchd_mysql.log #请修改为实际使用的绝对路径,例如:/usr/local/coreseek/var/... query_log = D:/SOFT_PHP_PACKAGE/search/yzdd/coreseek/var/log/query_mysql.log #请修改为实际使用的绝对路径,例如:/usr/local/coreseek/var/... binlog_path =D:/SOFT_PHP_PACKAGE/search/yzdd/coreseek/var/log/ #关闭binlog日志 } ~~~ 2.创建索引 indexer.exe --all indexer.exe delta 安装服务后 indexer.exe --all --rotate indexer.exe delta --rotate 3.安装服务 searchd.exe --install --config D:/SOFT_PHP_PACKAGE/search/yzdd/coreseek/bin/csft.conf 注册表路径 D:/SOFT_PHP_PACKAGE/search/yzdd/coreseek/bin/searchd.exe --ntservice --config D:/SOFT_PHP_PACKAGE/search/yzdd/coreseek/bin/csft.conf 4.计划任务 (1)mysql.bat(主索引文件) ~~~ d: cd D:/SOFT_PHP_PACKAGE/search/yzdd/coreseek/bin indexer.exe --all --rotate ~~~ delta.bat(增量索引文件) ~~~ d: cd D:/SOFT_PHP_PACKAGE/search/yzdd/coreseek/bin indexer.exe delta --rotate ~~~ (2)Windows 2008 服务器 开始->管理工具->任务计划程序->任务计划程序库->(右键点击)创建任务 ![](https://box.kancloud.cn/2981e08e294b6d827f4afa95d1da680d_631x531.png) ![](https://box.kancloud.cn/4c43d5dc3d40567ee9e3c057fbba1c79_725x525.png) ![](https://box.kancloud.cn/6009b4d9a37076addb1dc067f53c1c0c_639x530.png) 5.查看日志文件 searchd_mysql.log ![](https://box.kancloud.cn/ea1662dea9b0aaf474d3e0d7b8e8a21b_580x261.png) 的确是每隔五分钟执行一次增量索引