3

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?

Asco
  • 31
  • 3

1 Answers1

1

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).

pat
  • 16,116
  • 5
  • 40
  • 46
  • So I have to downgrade to thinking-sphinx 2.1.0 and use datetime-delta-indexing? – Asco Jan 28 '14 at 16:02
  • You can run `indexer --config config/production.sphinx.conf log_delta --rotate` to manually run the delta indexer with the current approach. Perhaps you want to elaborate why you feel the datetime deltas is the best way forward? – pat Jan 28 '14 at 22:49
  • But also: the latest commits in ts-datetime-delta supports TS v3. – pat Jan 28 '14 at 22:50
  • Thanks a lot for this command! It works for me. With this command I don't need ts-datetime-delta. :) – Asco Feb 03 '14 at 14:04