sphinx实现主索引+增量索引

in 搜索优化

装了几次没把sphinx集成到mysql中去(SphinxSE),只好放弃,使用其自带的api(sphinx.php)来试试。
官方的sphinx0.98不支持索引GBK的数据,后装了Coreseek提供的版本,几经测试后,终于搞定GBK的数据索引。
然后调用sphinx.php写了个搜索测试程序,终于试出来,也蛮好用的。

主要按照Coreseek整理的Sphinx0.98中文参考手册中的内容,这里记录一下。

创建主索引:
bin/indexer –config etc/sphinx.conf hx_9enjoy –rotate

创建增量索引:
bin/indexer –config etc/sphinx.conf delta –rotate

合并主索引和增量索引:
bin/indexer –config etc/sphinx.conf –merge hx_9enjoy delta –merge-dst-range deleted 0 0 –rotate

–rotate参数可以在不停searchd的情况下索引,不然的话会有类似如下的提示:
FATAL: failed to lock /usr/local/coreseek/var/data/hx_9enjoy_delta.spl: Resource temporarily unavailable, will not index. Try –rotate option.
ERROR: index ‘delta’ is already locked; lock: failed to lock /usr/local/coreseek/var/data/cncn_article_delta.spl: Resource temporarily unavailable

0 Comments

Leave a Reply

You must be logged in to post a comment.

Using Gravatars in the comments - get your own and be recognized!

XHTML: These are some of the tags you can use: <a href=""> <b> <blockquote> <code> <em> <i> <strike> <strong>