tag:support.flying-sphinx.com,2011-01-05:/discussions/problems/124-why-is-add_sphinx_index-being-called-when-i-create-an-activerecord-object Flying Sphinx: Discussion 2018-10-19T03:09:27Z tag:support.flying-sphinx.com,2011-01-05:Comment/13087107 2012-01-22T21:40:12Z 2012-01-22T21:40:12Z Why is add_sphinx_index being called when I create an ActiveRecord object? <div><p>Will someone from your support staff please answer this question?</p></div> Brett Levine tag:support.flying-sphinx.com,2011-01-05:Comment/13087107 2012-01-22T22:25:59Z 2012-01-22T22:25:59Z Why is add_sphinx_index being called when I create an ActiveRecord object? <div><p>Hi Brett</p> <p>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 <code>set_property :delta =&gt; true</code> (or similar) is being called.</p> <p>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 are.</p> <p>Let me know if you need any further clarification.</p> <p>Cheers</p> <p>Pat</p></div> Pat Allan tag:support.flying-sphinx.com,2011-01-05:Comment/13087107 2012-01-23T19:59:17Z 2012-01-23T19:59:17Z Why is add_sphinx_index being called when I create an ActiveRecord object? <div><p>Hey Pat,</p> <p>Thanks very much for the reply. I think I understand what you're saying, but to confirm more broadly that I'm doing the best thing...</p> <p>Your documentation states:<br> "The only indexing approach that's currently viable in combination with Heroku is a variation upon the Delayed Deltas."</p> <p>And also:<br> "Regular indexing is best managed by Cron &#8212; and Heroku makes this pretty easy."</p> <p>I'm not sure if this means, I really <em>should</em> use delta indexing with Heroku, or it's just optional.</p> <p>If I can live with reindexing every 30 minutes or so, am I better off using delta indexes or not? I am most concerned about model read/write performance being as good as possible.</p> <p>If I use delta indexes, I should still run rake fs:index every 30 minutes right?</p> <p>Thanks,<br> Brett</p></div> Brett Levine tag:support.flying-sphinx.com,2011-01-05:Comment/13087107 2012-01-24T11:03:59Z 2012-01-24T11:03:59Z Why is add_sphinx_index being called when I create an ActiveRecord object? <div><p>Hi Brett</p> <p>You don't have to use delta indexing - you should read your first quote as 'the only <em>delta</em> indexing approach&#8230;'. I'll update that accordingly. If you're fine with reindexing every 30 minutes, then that keeps things simpler, less moving parts.</p> <p>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).</p> <p>Cheers</p> <p>Pat</p></div> Pat Allan tag:support.flying-sphinx.com,2011-01-05:Comment/13087107 2012-01-24T19:33:33Z 2012-01-24T19:33:33Z Why is add_sphinx_index being called when I create an ActiveRecord object? <div><p>Hi Pat,</p> <p>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.</p> <p>Thanks,<br> Brett</p></div> Brett Levine