ruby on Rails - ultrasphinx
Ruby on Rails - UltraSphinx
大家好,我正在使用 Ultrasphinx 进行搜索。
我的问题是:我有“rake ultrasphinx:daemon:start”在后台运行。现在,我应该有一个定期执行“rake ultrasphinx:index”的 cron 作业,还是守护进程在创建新对象时负责索引。
请告诉我。这是一种紧急情况。
谢谢
Ruby on Rails - UltraSphinx
Hi guys, I'm using Ultrasphinx for the search thing.
My question is : I have the "rake ultrasphinx:daemon:start" running in the background. Now, should I have a cron job that does "rake ultrasphinx:index" regularly or will the daemon take care of indexing whenever a new object is created.
Please, let me know. Its kind of emergency.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您必须运行 cron 作业来定期更新索引。但是,您可以运行 rake 任务
ultrasphinx:index:delta
以仅更新包含最近更改的记录的增量索引。有时,您可能还想使用
ultrasphinx:index:merge
任务将增量索引合并到主索引中,希望这会有所帮助。
You will have to run a cron job to regularly update your index. However, you can run the rake task
ultrasphinx:index:delta
to only update the delta index which contains recently changed records.From time to time, you might also want to merge your delta index into your main index using the task
ultrasphinx:index:merge
Hope this helps.
如果您想使用增量索引,请将其添加到您的模型中:
运行 ultrasphinx 守护进程:
rake ultrasphinx:daemon:start
添加到您的 CRON(我每 10 分钟运行一次,但最终决定完全取决于您的应用程序):
rake ultrasphinx:index:delta
您需要每天运行 rake ultrasphinx:index:main 一次,将增量内容移动到主索引中。
来源:官方文档。
add this to your model if you want to use delta indexing:
Run ultrasphinx daemon:
rake ultrasphinx:daemon:start
Add to your CRON(I run it every 10 mins, but final decision is all up to your app):
rake ultrasphinx:index:delta
You will need to run rake ultrasphinx:index:main once a day to move the delta contents into the main index.
Source: official documentation.