Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Indexing associations
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  6 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Jim Ruther Nill  
View profile   Translate to Translated (View Original)
 More options Nov 17 2011, 10:47 pm
From: Jim Ruther Nill <jvn...@gmail.com>
Date: Fri, 18 Nov 2011 11:47:23 +0800
Local: Thurs, Nov 17 2011 10:47 pm
Subject: Indexing associations

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 must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Pat Allan  
View profile  
 More options Nov 18 2011, 9:09 am
From: Pat Allan <p...@freelancing-gods.com>
Date: Fri, 18 Nov 2011 21:09:46 +0700
Local: Fri, Nov 18 2011 9:09 am
Subject: Re: [ts] Indexing associations
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:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jim Ruther Nill  
View profile  
 More options Nov 18 2011, 11:02 am
From: Jim Ruther Nill <jvn...@gmail.com>
Date: Sat, 19 Nov 2011 00:02:19 +0800
Local: Fri, Nov 18 2011 11:02 am
Subject: Re: [ts] Indexing associations

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 <p...@freelancing-gods.com>wrote:

--
-------------------------------------------------------------
visit my blog at http://jimlabs.heroku.com

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Pat Allan  
View profile  
 More options Nov 20 2011, 12:47 am
From: Pat Allan <p...@freelancing-gods.com>
Date: Sun, 20 Nov 2011 12:47:27 +0700
Local: Sun, Nov 20 2011 12:47 am
Subject: Re: [ts] Indexing associations
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:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jim Ruther Nill  
View profile  
 More options Nov 20 2011, 5:33 am
From: Jim Ruther Nill <jvn...@gmail.com>
Date: Sun, 20 Nov 2011 18:33:10 +0800
Local: Sun, Nov 20 2011 5:33 am
Subject: Re: [ts] Indexing associations

cool. Thanks Pat! I'll let you know how it goes when I try it tomorrow.
Thanks!

--
-------------------------------------------------------------
visit my blog at http://jimlabs.heroku.com

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jim Ruther Nill  
View profile  
 More options Nov 20 2011, 11:14 pm
From: Jim Ruther Nill <jvn...@gmail.com>
Date: Mon, 21 Nov 2011 12:14:13 +0800
Local: Sun, Nov 20 2011 11:14 pm
Subject: Re: [ts] Indexing associations

On Sun, Nov 20, 2011 at 6:33 PM, Jim Ruther Nill <jvn...@gmail.com> wrote:

This is working perfectly Pat. Thanks again!

--
-------------------------------------------------------------
visit my blog at http://jimlabs.heroku.com

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »