Pat,

Whoops, my bad.  We had a stripped-down version of the model lying
that shouldn't have been.  This didn't include the TS declaration,
thus it wasn't being picked up in this code-path.  TS works fine
outside of rails with AR.

The comments on the work-flow for delta indexing with DJ was key to
getting me setup in any case.

I appreciate your help and diligence.  Best, -Chris


On Jun 29, 10:55 pm, Pat Allan <[email protected]> wrote:
> Hi Chris
>
> You're right, this is a bit different to the standard use-case. Still,  
> if you've got Thinking Sphinx loading in your external service with  
> AR, then I'm surprised it's not working - there is the after_commit  
> hook that should be firing off to add the task. Don't suppose you've  
> figured out why it's not?
>
> Otherwise, a manual way of firing off the indexing after each change  
> is the following:
> Phrase.index_delta(phrase_instance)
>
> Cheers
>
> --
> Pat
>
> On 29/06/2009, at 4:21 PM, cera wrote:
>
>
>
> > I've been able to answer my own question by snooping around the code.
> > It appears that the DJ code is populated after the AR object is saved.
>
> > I've added numerous print statements, and I can see that the
> > 'Deliberately blank' after_commit() method is called after save() is
> > called in vendor/after_commit/lib/after_commit/active_record.rb.
>
> > I should have mentioned that my save() call is coming from outside of
> > rails, but still uses AR.  I setup a test controller in Rails, and I
> > can now see an attempt to insert into the DJ table.
>
> > I suspect my use case is outside the use case under which this was
> > developed.  Is there an easy way to trigger this after the save() is
> > called that doesn't use all of the after_commit magic?
>
> > Thanks, -Chris
>
> > On Jun 29, 10:35 am, cera <[email protected]> wrote:
> >> Hi Pat,
>
> >> Thanks for the response.
>
> >> I'm using rails 2.1.0, and and ts version 1.1.22 installed as a
> >> plugin.  I'm running in the cygwin environment for development, which
> >> I suppose could be a problem.
>
> >> I don't have any after_* callbacks that I know of, but I'll double-
> >> check into this.
>
> >> I'd like to understand who/what inserts into the delayed_jobs table.
> >> Is it rails after the model gets saved, or is it the separate
> >> delayed_delta task?
>
> >> I'm going to start poking around the TS code to get a better
> >> understanding of how it works.  Thanks, -Chris
>
> >> On Jun 28, 1:35 am, Pat Allan <[email protected]> wrote:
>
> >>> Hi Chris
>
> >>> What you've described all sounds correct. I'm not quite sure what's
> >>> going wrong - there should be jobs appearing in the delayed_jobs
> >>> table. Are there any after_* callbacks on your model? (Although,
> >>> wouldn't think that'd change anything, but I'm not sure how to  
> >>> proceed).
>
> >>> What versions of Rails and Thinking Sphinx are you using?
>
> >>> --
> >>> Pat
>
> >>> On 25/06/2009, at 10:34 AM, cera wrote:
>
> >>>> Hi everyone,
>
> >>>> I'm trying to setup delta indexing using the Delayed Job method
> >>>> discussed in the documentation.  I believe I've done everything
> >>>> mentioned in the documentation, but my indexes never get updated
> >>>> automatically.  I believe my problem is a lack of understanding the
> >>>> workflow and how this interaction is supposed to work.
>
> >>>> I have two processes running: first is the ts:start task, and in
> >>>> another terminal the ts:dd.  I have a 'delta' column in my model,  
> >>>> and
> >>>> these records get saved through ActiveRecord.  When they are saved,
> >>>> the delta column is set to 1.  I don't understand what triggers the
> >>>> indexing to happen, and my delayed_jobs table doesn't contain any
> >>>> rows.
>
> >>>> Could someone please tell me what is supposed to happen next, or  
> >>>> what
> >>>> I am missing?
>
> >>>> I have the following in my model:
>
> >>>> class Phrase < ActiveRecord::Base
> >>>>  belongs_to :document
>
> >>>>  define_index do
> >>>>    indexes text
> >>>>    set_property :delta => :delayed
> >>>>  end
> >>>> end
>
> >>>> I appreciate any help.  Thank you, -Chris
--~--~---------~--~----~------------~-------~--~----~
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