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
> --
> You received this message because you are subscribed to the Google Groups "Thinking Sphinx" group.
> To post to this group, send email to thinkin...@googlegroups.com.
> To unsubscribe from this group, send email to thinking-sphi...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/thinking-sphinx?hl=en.
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
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 :)
On Sun, Nov 20, 2011 at 1:47 PM, Pat Allan <p...@freelancing-gods.com> wrote: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 :)
cool. Thanks Pat! I'll let you know how it goes when I try it tomorrow. Thanks!