Search code examples
ruby-on-railssphinxthinking-sphinxdelta

Why need to run delta indexing after new records and change in records


As per my search and understanding in delta indexing when we add new records or do changes in records we need to re index sphinx to show that data otherwise it will not show.

But I check that data is updating without re indexing. So what the purpose of re indexing delta


Solution

  • With Thinking Sphinx, there's the distinction between a full re-index where all the indices are reprocessed (via rake ts:index and rake Ts:rebuild), and processing a single index.

    When you have delta indexing enabled, it means that the delta index for a given model is automatically processed straight after the change to a record, or adding a new record. This is either done as part of the standard callback process (when using :delta => true) or via a background worker (Sidekiq, DelayedJob, etc) if you're using the appropriate delta gem for those.

    All of this means that you don't need to run a full reprocessing of all indices for the change to be present - the delta index is reprocessed automatically, and the record's changes are reflected in Sphinx.

    One catch worth noting is that the more changes that happen, the larger the delta index gets, and thus the slower it is to process. So, a full re-index is still required on a regular basis (hourly? daily? depends on your app) to keep delta processing times fast.