Core-Index 有效,但 Delta-Index 无效。但奇怪的是,日志文件中没有错误或警告,所以我不知道如何调试它。 我用 phusion-passenger 测试了它,并在本地用 Webbrick 测试了它。结果是一样的。 我使用 rails 3.2.13 和 thinking-sphinx 3.1.0。
我的索引定义:
ThinkingSphinx::Index.define :log, :with => :active_record, :delta => true do
indexes msg, :sortable => true
has moment, :type => :timestamp
has program, :type => :string
end
我也尝试使用 delayed-delta 得到相同的结果。
有什么想法吗?
谢谢!
编辑: 是不是我直接通过MySQL把数据写入数据库? 那么只有使用 rails+active_record 才能识别新记录?
最佳答案
您的编辑是正确的 - 增量仅通过 ActiveRecord 回调触发,因此如果您不是通过标准 ActiveRecord 工作流程编辑/添加对象,Sphinx 索引将不会更新。
这同样适用于 update_attribute
方法(注意:单数版本),因为在调用时不会调用回调(不同于 update_attributes
和 save
等)。
关于ruby-on-rails - 增量索引不适用于 Thinking Sphinx,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21257301/