At a basic level, you'd need to update all of those tasks, but jobs will not be 
duplicated (however, if a job is completed before all 50 tasks are updated, 
then another would be added).

There is a better way, of course - it's just a little more fiddly.

Firstly, update the delta flags in one SQL statement (assuming this is done 
within the context of a project object):

  Task.update_all({:delta => true}, {:project_id => id})

And then, let's just manually create the delta job:

  ThinkingSphinx::Deltas::Job.enqueue(
    ThinkingSphinx::Deltas::DeltaJob.new(Task.delta_index_names),
    ThinkingSphinx::Configuration.instance.delayed_job_priority
  )

That should be the best approach from a performance perspective. Let us know 
how it goes :)

-- 
Pat

On 18/11/2011, at 11:02 PM, Jim Ruther Nill wrote:

> Hi Pat,
> 
> Thanks for getting back to me.  There's no limit to the number of tasks per 
> project.
> A good estimate would be around 50 tasks per project.  Does this mean that
> everytime the project changes status, i have to update those 50 tasks? Sorry 
> but
> does that also mean that the delayed delta will queue 50 jobs to delayed_job?
> 
> Thanks!
> 
> Jim
> 
> On Fri, Nov 18, 2011 at 10:09 PM, Pat Allan <[email protected]> wrote:
> Hi Jim
> 
> I guess what you'll want to do is have a after_commit hook on your project 
> model that updates the delta flags on all tasks for that project (which will 
> in turn fire the delta callback for them). This will ensure Sphinx's data is 
> close to up-to-date.
> 
> How many tasks are generally tied to a project?
> 
> --
> Pat
> 
> On 18/11/2011, at 10:47 AM, Jim Ruther Nill wrote:
> 
> > Hi!
> >
> > in my define_index block inside the Task model i have a where clause
> >
> > where 'project.status != "closed"'
> >
> > but everytime I change the project status, I have to reindex else the
> > search results will be wrong.  Is there any better way to do this?  I have
> > delayed delta indexing enabled for tasks.  I wonder if I also need to do
> > this for projects.
> >
> > Thanks!
> >
> > --
> > 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.
> 
> 
> 
> 
> -- 
> -------------------------------------------------------------
> visit my blog at http://jimlabs.heroku.com
> 
> -- 
> 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