Search code examples
ruby-on-railsthinking-sphinx

Are deltas on Thinking Sphinx polymorphic indexes updated when association has been modified?


In my index file I have delta turned on and have setup my polymorphic index like such:

polymorphs colorable
indexes colorable.description

However, when the colorable's description changes it appears that the index is not updated. A manual ts:index is required for the changes to reflect.

I am not using realtime indexing however the deltas seem to work just fine.

Do polymorphic indexes get updated when the association is updated? If not, what is the best way to handle this?

Thanks


Solution

  • Association updates - whether polymorphic or standard - do not automatically update the parent model's delta flag. You'll want to add a callback in your colorable models to update the delta flag in the parent model whenever that colorable model is saved.

    There's an example in the documentation - about halfway down the page under the 'Deltas and Associations' section: http://freelancing-gods.com/thinking-sphinx/deltas.html