sphinx全部配置好后需要设置一个计划任务让它自动定时来更新索引
1.windows下
需要设置计划任务
#凌晨4点合并索引,执行merge.bat
#其余时间每分钟更新索引,执行delta.bat
merge.bat
@ECHO off
D:\sphinx\bin\indexer.exe --config D:\sphinx\sphinx.conf --merge main delta --rotate
echo indexing, window will close when complete
delta.bat
@ECHO off
D:\sphinx\bin\indexer.exe --config D:\sphinx\sphinx.conf delta --rotate
echo indexing, window will close when complete
2.linux下编辑定时任务 crontab -e
#凌晨4点合并索引,其余时间每分钟更新索引
* 0-3 * * * /usr/local/sphinx/bin/indexer --config /usr/local/sphinx/etc/sphinx.conf delta --rotate
* 6-23 * * * /usr/local/sphinx/bin/indexer --config /usr/local/sphinx/etc/sphinx.conf delta --rotate
0 4 * * * /usr/local/sphinx/bin/indexer --config /usr/local/sphinx/etc/sphinx.conf --merge main delta --rotate
(责任编辑:ken)