Asco
Asco

Reputation: 31

Delta Indexing not working with Thinking Sphinx

Core-Index works, but Delta-Index just does not work. But the strange thing is, that there are no errors or warnings in the log-files, so I don't know how to debug it. I tested it with phusion-passenger and locally with Webbrick. The results are the same. I use rails 3.2.13 and thinking-sphinx 3.1.0.

My index-definition:

ThinkingSphinx::Index.define :log, :with => :active_record, :delta => true do
  indexes msg, :sortable => true
  has moment, :type => :timestamp
  has program, :type => :string
end

I also tried using delayed-delta with the same results.

Any ideas?

Thanks!

Edit: Is it because I write the data directly via MySQL into the database? So new records are only recognized, if rails+active_record are used?

Upvotes: 3

Views: 1148

Answers (1)

pat
pat

Reputation: 16226

Your edit is correct - deltas are only fired via ActiveRecord callbacks, so if you're not editing/adding objects through the standard ActiveRecord workflow, Sphinx indices won't be updated.

The same applies for the update_attribute method (note: the singular version), as callbacks are not invoked when it is called (unlike update_attributes and save, etc).

Upvotes: 1

Related Questions