Pat,
   You are correct. The root cause was something else. I delay the
delta indexing of a message(by setting delta to false) as I need
perform inbox calculation logic asynchronously. I set the `delta` to
true, after the inbox calculation logic is complete. The code for
updating `delta` used to look like this:

self.update_attribute(:delta, true)

I had to change the logic to:

self.delta = true
self.save


In the older version of Rails, `update_attribute` used to tigger the
'*_save` callbacks. This is contrary to the behavior described in
Rails documentation.
I am currently using Rails 2.3.5. I am not sure if new Rails OR new
`after_commit` is causing this issue. On the other hand, since this is
the suggested behavior I would not consider this as a TS issue.

Thanks for your help.


-kb

On Apr 22, 7:27 pm, Pat Allan <[email protected]> wrote:
> Hi Kandada
>
> I don't think your code change will actually work, because you're referring 
> to methods on the model, not columns in the database. I would recommend 
> switching back to the previous index definition, but don't explicitly set a 
> type, because it should be an array of integers (MVA), not an integer 
> attribute.
>
> Hope this helps.
>
> --
> Pat
>
> On 23/04/2010, at 10:57 AM, Kandada Boggu wrote:
>
>
>
> > I was able to fix this problem.
>
> > I changed the Message class from:
>
> > class Message
> >  has_many :message_subjects
>
> >  define_index do
> >    indexes content
> >    has message_subjects(:subject_id), :type => :integer, :as
> > => :subject, :facet => true
> >    set_property :delta => :delayed
> >  end
> > end
>
> > to:
>
> > class Message
> >  has_many :message_subjects
>
> >  define_index do
> >    indexes content
> >    has message_subject_ids, :type => :integer, :as
> > => :subject, :facet => true
> >    set_property :delta => :delayed
> >  end
>
> >  def message_subject_ids
> >   �...@message_subject_ids ||= message_subjects.map(&:subject_id)
> >  end
> > end
>
> > It looks like using has_many association as input for `has` method
> > doesn't work. This used to work for sure. May be this is a regression
> > issue.
>
> > On Apr 22, 5:46 pm, Kandada Boggu <[email protected]> wrote:
> >> My problem is similar to the one raised in this 
> >> thread:http://groups.google.com/group/thinking-sphinx/browse_thread/thread/b...
>
> >> On Apr 22, 5:30 pm, Kandada Boggu <[email protected]> wrote:
>
> >>> Delta indexing feature stopped working for me (i.e. rake ts:dd). I am
> >>> indexing a Message model and the `messages` table row has the correct
> >>> valye for the `delta` column(true).
>
> >>> When I was using ThinkingSphinx as a plugin this feature used to work
> >>> for me.
>
> >>>   define_index do
> >>>     indexes content
> >>>     indexes inbox_messages(:user_id), :as => :users
> >>>     indexes message_subjects(:subject_id), :as => :subjects
> >>>     has created_at
> >>>     set_property :delta => :delayed
> >>>   end
>
> >>> I am on TS 1.3.16
>
> >>> --
> >>> 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 
> >> 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 
> > 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 
> 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.

Reply via email to