简体   繁体   English

Rails和thinking_sphinx什么时候我应该做reindex?

[英]Rails and thinking_sphinx when I should do reindex?

I need run ts:reindex when smth add in model or destroy from model. 当smth在模型中添加或从模型中销毁时,我需要运行ts:reindex。 How should I do this? 我该怎么做?

  1. Write cron job (for example run every hour). 编写cron作业(例如每小时运行一次)。
  2. I tried add ts:reindex in model callbacks, but this does not work for me. 我尝试在模型回调中添加ts:reindex,但这对我不起作用。
  3. Or is there a common way to solve this problem? 或者有一种解决这个问题的常用方法吗?

Using: 使用:

thinking-sphinx (2.0.11)
rails (3.1.3)

Take a look at deltas. 看看三角洲。 You can read about them there http://freelancing-god.github.com/ts/en/deltas.html Cron job is an option also, but deltas much better, they simulate real-time index. 你可以在那里阅读它们http://freelancing-god.github.com/ts/en/deltas.html Cron job也是一个选项,但是deltas要好得多,它们模拟实时索引。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM