Why is add_sphinx_index being called when I create an ActiveRecord object?
Support Staff2 Posted by Pat Allan on 22 Jan, 2012 10:25 PM
This happens because Thinking Sphinx does not process the
define_index blocks as the models are loaded, but only when there's
an operation that may require TS to do something. In this case, TS
needs to determine whether there is a delta index for the model, so
it needs to process the block to see if set_property :delta
=> true (or similar) is being called.
While this will happen in the development environment on every
relevant request, in production it should only get called once - as
the index definitions will be remembered like the model definitions
Let me know if you need any further clarification.
Support Staff4 Posted by Pat Allan on 24 Jan, 2012 11:03 AM
You don't have to use delta indexing - you should read your first quote as 'the only *delta* indexing approach…'. I'll update that accordingly. If you're fine with reindexing every 30 minutes, then that keeps things simpler, less moving parts.
That said, if you want something a little more up-to-date, then certainly give delta indexes a shot. And yes, if you do opt for deltas, you'll still need a regular full index (though wouldn't need to be every 30 minutes).
Thanks for the reply. I sort of guessed that was your intention with the docs but wanted to make sure. Since we don't need immediate updating I'll fall back to just the rake task and remove delta indexing.