I've not tried this myself, but I think it should work:

  define_index do
    # ...
  end
  
  # need to force the above block to be processed
  define_indexes
  
  # it's important you add this callback after processing the index
  # else this will happen before Thinking Sphinx's callback.
  before_save :disable_delta
  
  # ...
  
  private
  
  def disable_delta
    self.delta = false unless body_changed?
  end


You can make that method as complicated as you like. Let me know how this goes.

Cheers

-- 
Pat

On 02/01/2011, at 2:13 PM, jollibee wrote:

> Sphinx will re-index the record every time we update it when we use
> delta, even if the updated data is not in the record index field. For
> example, we index 'body' field in notes.rb, but think-sphinx will re-
> index when we update the visited_at of a note.
> 
> Is there any way to disable the  unnecessary index. Only index when
> update the 'body' field.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Thinking Sphinx" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/thinking-sphinx?hl=en.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Thinking Sphinx" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/thinking-sphinx?hl=en.

Reply via email to