Hi Patrick

Thinking Sphinx supports the old ActiveRecord option for includes:

  Post.search('foo', :include => :research_report)

Give that a spin, it should help matters.

Cheers

-- 
Pat

On 03/08/2011, at 9:13 AM, patrick99e99 wrote:

> So, I have a Post model and one of my controllers is searching it via
> the facets method...
> 
> In my view, I am doing:
> 
> <% if post.research_report %>
> ....
> <% else %>
> ....
> 
> and my log shows:
>  ResearchReport Load (0.5ms)  SELECT `research_reports`.* FROM
> `research_reports` WHERE (`research_reports`.post_id = 4) LIMIT 1
>  ResearchReport Load (0.5ms)  SELECT `research_reports`.* FROM
> `research_reports` WHERE (`research_reports`.post_id = 25) LIMIT 1
>  ResearchReport Load (0.3ms)  SELECT `research_reports`.* FROM
> `research_reports` WHERE (`research_reports`.post_id = 11) LIMIT 1
>  ResearchReport Load (0.3ms)  SELECT `research_reports`.* FROM
> `research_reports` WHERE (`research_reports`.post_id = 3) LIMIT 1
>  ResearchReport Load (0.3ms)  SELECT `research_reports`.* FROM
> `research_reports` WHERE (`research_reports`.post_id = 36) LIMIT 1
> ... etc
> 
> I know normally I would solve this by doing
> Post.includes(:research_report)...  But, how is the proper way to
> address this issue with Sphinx?
> 
> -patrick
> 
> -- 
> 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