Ah, sorry - I got that slightly wrong - update_attribute expects a column and 
value as two separate arguments, not a hash:

  account.update_attribute :delta, true

Does that work? If not, how is it not working?

-- 
Pat

On 08/04/2011, at 1:14 AM, rahul100885 wrote:

> Pat,
> 
> Really thanks for reply, I have already tried this solution, but my
> new contact or account is not getting listed in search.
> 
> Ok no issues I will try it again and let you know.
> Since I tried
>   account.update_attribute(:delta => true)
> 
> but not Account.index_delta
> 
> I guess it should work.
> 
> Thanks,
> Rahul P. Chaudhari
> 
> On Apr 7, 8:58 am, Pat Allan <[email protected]> wrote:
>> Hi Rahul
>> 
>> This is a little tricky, but perhaps try the following (from the Contact 
>> perspective): instead of performing a normal update to the accounts, use the 
>> update_attribute method (singular, not plural), as that doesn't fire 
>> callbacks:
>> 
>>   account.update_attribute(:delta => true)
>> 
>> And then just update the account delta index on a model level, instead of 
>> instance:
>> 
>>   Account.index_delta
>> 
>> This avoids all callbacks, and so should avoid the looping.
>> 
>> Also, you may want to simplify things further by just updating the delta 
>> flag directly in the database, using the update_all method (double-check 
>> this, but I think it should work):
>> 
>>   Account.update_all {:delta => true}, {:id => account_ids}
>> 
>> (First hash is values to change, second is the conditions on the UPDATE 
>> statement).
>> 
>> Cheers
>> 
>> --
>> Pat
>> 
>> On 04/04/2011, at 11:11 PM, rahul100885 wrote:
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>>> Hi,
>> 
>>> In my application I am using thinking sphinx extensively. But
>>> currently I am facing an issue with delta indexing.
>>> My delta indexing goes into infinite loop.
>> 
>>> e.g
>>> Suppose I have Account and Contact model with many-many relationship.
>>> As specified in thinking-sphinx documentation, use callback for
>>> updating respective model
>> 
>>> So if I update any contact, I have a callback to update related
>>> Accounts in Contacts.
>> 
>>> and vice-versa (Account has a callback for updating respective
>>> Contacts)
>> 
>>> Now if I update any contact it goes into loop via callback.
>> 
>>> Is there any standard solution for this situation.
>> 
>>> Also let me know how delta indexing work, will it add any callback for
>>> delta indexing.
>> 
>>> Thanks,
>>> Rahul P. Chaudhari
>> 
>>> --
>>> 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