如何使用 MySQL 重新索引 Sphinx
我正在尝试弄清楚应该如何重新索引 Sphinx。我使用的是 v 0.9.9,所以我无法实时更新索引。
我想我在某处读到这可以使用 cron 作业来完成,并且索引不需要完全重建(因此不需要停止守护进程)。也就是说,我从未编写或运行过任何 cron 作业,所以不知道从哪里开始。
有什么想法吗?
I'm trying to figure out how I should be reindexing Sphinx. I'm using v 0.9.9, so I don't have the ability to do real-time updates of the index.
I think I read somewhere that this can be done using a cron job, and that the index does not need to be entirely rebuilt (so no stopping the daemon). That said, I've never written nor run any cron jobs, so no idea where to even start.
Any thoughts?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为你追求的是主+增量索引。您构建的主索引假设每天一次,然后每 5 分钟(或您需要的任何时间段)更新一次,以更新自上次构建以来的更改。文档中有一些内容解释了这一点,谷歌上也有关于这一点的帖子。
http://sphinxsearch.com/docs/current.html#delta-updates
就每 5 分钟重建增量的 cronjob 而言,您需要类似的内容:
I think what you're after is a main+delta index. The main index you build say once a day then every 5 minutes (or whatever period you need) you'd update it with changes since the last time it built. There is something in the docs that explains this and there are also posts on Google about this as well.
http://sphinxsearch.com/docs/current.html#delta-updates
In terms of the cronjob to rebuild your delta every 5 minutes you'd want something like: