Yes, you just need to define that method on your model - probably best to keep 
it private, but up to you.

Cheers

-- 
Pat

On 16/10/2010, at 4:34 AM, calvin wrote:

> Hi Pat,
> 
> Can you tell me the best way to override the indexed_data_changed?
> method? Is it as simple as doing
> 
> def indexed_data_changed?
> end
> 
> in my model?
> 
> Thanks.
> Calvin
> 
> 
> 
> On Oct 15, 12:17 am, Pat Allan <[email protected]> wrote:
>> Hi Calvin
>> 
>> You could definitely try overriding that method - I've not done it before, 
>> but can't see why it wouldn't work.
>> 
>> The reason TS always returns true is because you've got the manual attribute 
>> contact_filter_user_id, and TS isn't able to figure out whether that needs 
>> updating or not, so assumes it should by default.
>> 
>> Though I'm guessing you realise this already, given you've investigated the 
>> underlying code already – this is more for everyone else reading this :)
>> 
>> I guess what you'd want to do in your new version is check whether 
>> profile.about_me has changed, and return true if it has.
>> 
>> Cheers
>> 
>> --
>> Pat
>> 
>> On 15/10/2010, at 5:05 PM, calvin wrote:
>> 
>> 
>> 
>>> Hi,
>> 
>>> Is it possible to override indexed_data_changed? with my own logic? My
>>> issue is that indexed_data_changed? is always returning true
>>> regardless if the indexed data is actually changed. Here is how I've
>>> defined
>> 
>>> class User < ActiveRecord::Base
>> 
>>>  has_one :profile, :dependent => :destroy
>> 
>>>  define_index 'user_base' do
>>>    indexes profile.about_me
>> 
>>>    has '0', :type => :integer, :as => :contact_filter_user_id
>> 
>>>    set_property :delta => :delayed
>>>  end
>> 
>>> ....
>>> end
>> 
>>> Every time I save a user, it thinks profile.about_me has chnaged and
>>> thus flags the delta. The index still works, but it just creates a lot
>>> of unnecessary delta indexing load.
>> 
>>> Any idea what would be a good way to solve this?
>> 
>>> Thanks.
>>> Calvin
>> 
>>> --
>>> 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 
>>> athttp://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.
> 

-- 
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