<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Eager Loading with Ultrasphinx</title>
	<atom:link href="http://thinkingdigitally.com/archive/eager-loading-with-ultrasphinx/feed/" rel="self" type="application/rss+xml" />
	<link>http://thinkingdigitally.com/archive/eager-loading-with-ultrasphinx/</link>
	<description>programming for the fun of it</description>
	<lastBuildDate>Thu, 29 Mar 2012 16:19:31 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.5</generator>
	<item>
		<title>By: Brian Armstrong</title>
		<link>http://thinkingdigitally.com/archive/eager-loading-with-ultrasphinx/#comment-2526</link>
		<dc:creator>Brian Armstrong</dc:creator>
		<pubDate>Fri, 16 Oct 2009 21:14:14 +0000</pubDate>
		<guid isPermaLink="false">http://thinkingdigitally.com/archive/eager-loading-with-ultrasphinx/#comment-2526</guid>
		<description>&lt;p&gt;Great writeup!&lt;/p&gt;

&lt;p&gt;Just wanted to mention that you may also want to use find_all_by_id instead of find in the first solution.  This prevents the problem when one of your records is deleted, but is still in the index.  If you just use find it will throw a record not found exception, but if you use find_all_by_id it will return 9 out of the 10 records, even if one of the ids doesn&#039;t exist.  Thanks!
Brian&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Great writeup!</p>

<p>Just wanted to mention that you may also want to use find_all_by_id instead of find in the first solution.  This prevents the problem when one of your records is deleted, but is still in the index.  If you just use find it will throw a record not found exception, but if you use find_all_by_id it will return 9 out of the 10 records, even if one of the ids doesn&#8217;t exist.  Thanks!
Brian</p>]]></content:encoded>
	</item>
	<item>
		<title>By: michal kuklis</title>
		<link>http://thinkingdigitally.com/archive/eager-loading-with-ultrasphinx/#comment-2461</link>
		<dc:creator>michal kuklis</dc:creator>
		<pubDate>Sun, 12 Jul 2009 06:23:57 +0000</pubDate>
		<guid isPermaLink="false">http://thinkingdigitally.com/archive/eager-loading-with-ultrasphinx/#comment-2461</guid>
		<description>&lt;p&gt;great post!
thanks for sharing!&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>great post!
thanks for sharing!</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Ole</title>
		<link>http://thinkingdigitally.com/archive/eager-loading-with-ultrasphinx/#comment-2456</link>
		<dc:creator>Ole</dc:creator>
		<pubDate>Fri, 26 Jun 2009 09:58:56 +0000</pubDate>
		<guid isPermaLink="false">http://thinkingdigitally.com/archive/eager-loading-with-ultrasphinx/#comment-2456</guid>
		<description>&lt;p&gt;Hi,&lt;/p&gt;

&lt;p&gt;thanks for this solution. I&#039;m wondering if it&#039;s possible to support hierarchies of associations too, like so:&lt;/p&gt;

&lt;p&gt;:eagerly_load =&gt; [ :author, { :comments =&gt; { :author =&gt; :gravatar } }&lt;/p&gt;

&lt;p&gt;That would be a great feature! So far I couldn&#039;t get it to work.&lt;/p&gt;

&lt;p&gt;Cheers from Berlin&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Hi,</p>

<p>thanks for this solution. I&#8217;m wondering if it&#8217;s possible to support hierarchies of associations too, like so:</p>

<p>:eagerly_load =&gt; [ :author, { :comments =&gt; { :author =&gt; :gravatar } }</p>

<p>That would be a great feature! So far I couldn&#8217;t get it to work.</p>

<p>Cheers from Berlin</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Cheri</title>
		<link>http://thinkingdigitally.com/archive/eager-loading-with-ultrasphinx/#comment-2009</link>
		<dc:creator>Cheri</dc:creator>
		<pubDate>Sat, 10 May 2008 19:08:14 +0000</pubDate>
		<guid isPermaLink="false">http://thinkingdigitally.com/archive/eager-loading-with-ultrasphinx/#comment-2009</guid>
		<description>&lt;p&gt;Hi Rob, that&#039;s a good plugin to know about!  I&#039;ll give it a try when my application gets more complicated.  Here was another way I found to apply conditions to eagerly loaded models.&lt;/p&gt;

&lt;p&gt;Location.find(loc_id, :include =&gt; [:subcategories], :conditions =&gt;
[&quot;subcategories.location_id = ?&quot;, loc_id])&lt;/p&gt;

&lt;p&gt;Thanks again for your help!&lt;/p&gt;

&lt;p&gt;Cheri&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Hi Rob, that&#8217;s a good plugin to know about!  I&#8217;ll give it a try when my application gets more complicated.  Here was another way I found to apply conditions to eagerly loaded models.</p>

<p>Location.find(loc_id, :include =&gt; [:subcategories], :conditions =&gt;
["subcategories.location_id = ?", loc_id])</p>

<p>Thanks again for your help!</p>

<p>Cheri</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Rob Olson</title>
		<link>http://thinkingdigitally.com/archive/eager-loading-with-ultrasphinx/#comment-1587</link>
		<dc:creator>Rob Olson</dc:creator>
		<pubDate>Mon, 05 May 2008 18:30:36 +0000</pubDate>
		<guid isPermaLink="false">http://thinkingdigitally.com/archive/eager-loading-with-ultrasphinx/#comment-1587</guid>
		<description>&lt;p&gt;Cheri,&lt;/p&gt;

&lt;p&gt;If you&#039;ve setup your ActiveRecord associations correctly where a Location has many subcategories and subcategories belong to Locations then it should work as you desire.&lt;/p&gt;

&lt;p&gt;You might want to check out the has_finder plugin
http://pivots.pivotallabs.com/users/nick/blog/articles/284-hasfinder-it-s-now-easier-than-ever-to-create-complex-re-usable-sql-queries
You could use that to create more complex filters that are not done for you by ActiveRecord.&lt;/p&gt;

&lt;p&gt;Let me know if that helps.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Cheri,</p>

<p>If you&#8217;ve setup your ActiveRecord associations correctly where a Location has many subcategories and subcategories belong to Locations then it should work as you desire.</p>

<p>You might want to check out the has_finder plugin
<a href="http://pivots.pivotallabs.com/users/nick/blog/articles/284-hasfinder-it-s-now-easier-than-ever-to-create-complex-re-usable-sql-queries" rel="nofollow">http://pivots.pivotallabs.com/users/nick/blog/articles/284-hasfinder-it-s-now-easier-than-ever-to-create-complex-re-usable-sql-queries</a>
You could use that to create more complex filters that are not done for you by ActiveRecord.</p>

<p>Let me know if that helps.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Cheri</title>
		<link>http://thinkingdigitally.com/archive/eager-loading-with-ultrasphinx/#comment-1295</link>
		<dc:creator>Cheri</dc:creator>
		<pubDate>Sun, 04 May 2008 21:50:11 +0000</pubDate>
		<guid isPermaLink="false">http://thinkingdigitally.com/archive/eager-loading-with-ultrasphinx/#comment-1295</guid>
		<description>&lt;p&gt;Hi Rob,&lt;/p&gt;

&lt;p&gt;Thank your response!  Do you know if there is a way to filter eagerly loaded models before they are loaded from the database?  Say I want to find all Locations, but load only subcategories where subcategory.location_id = location.id.  Do you know of a way to modify the statement below to do this?&lt;/p&gt;

&lt;p&gt;@location = Location.find(loc_id, :include =&gt; [:subcategories])&lt;/p&gt;

&lt;p&gt;Thanks&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Hi Rob,</p>

<p>Thank your response!  Do you know if there is a way to filter eagerly loaded models before they are loaded from the database?  Say I want to find all Locations, but load only subcategories where subcategory.location_id = location.id.  Do you know of a way to modify the statement below to do this?</p>

<p>@location = Location.find(loc_id, :include =&gt; [:subcategories])</p>

<p>Thanks</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Rob Olson</title>
		<link>http://thinkingdigitally.com/archive/eager-loading-with-ultrasphinx/#comment-85</link>
		<dc:creator>Rob Olson</dc:creator>
		<pubDate>Mon, 28 Apr 2008 00:59:55 +0000</pubDate>
		<guid isPermaLink="false">http://thinkingdigitally.com/archive/eager-loading-with-ultrasphinx/#comment-85</guid>
		<description>&lt;p&gt;Yes, Cheri that does work for me. This is how I run it.&lt;/p&gt;

&lt;p&gt;
search = Ultrasphinx::Search.new(:query =&gt; &quot;computer science&quot;)&lt;br /&gt;
search.run&lt;/p&gt;

&lt;p&gt;@courses = search.results&lt;br /&gt;
c1 = @courses.first&lt;br /&gt;
puts c1.professors
&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Yes, Cheri that does work for me. This is how I run it.</p>

<p>
search = Ultrasphinx::Search.new(:query => &#8220;computer science&#8221;)<br />
search.run</p>

<p>@courses = search.results<br />
c1 = @courses.first<br />
puts c1.professors
</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Cheri</title>
		<link>http://thinkingdigitally.com/archive/eager-loading-with-ultrasphinx/#comment-84</link>
		<dc:creator>Cheri</dc:creator>
		<pubDate>Sun, 27 Apr 2008 23:28:44 +0000</pubDate>
		<guid isPermaLink="false">http://thinkingdigitally.com/archive/eager-loading-with-ultrasphinx/#comment-84</guid>
		<description>&lt;p&gt;Please nix the &quot;?&quot; after course.professors in my comment above.  Thanks&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Please nix the &#8220;?&#8221; after course.professors in my comment above.  Thanks</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Cheri</title>
		<link>http://thinkingdigitally.com/archive/eager-loading-with-ultrasphinx/#comment-83</link>
		<dc:creator>Cheri</dc:creator>
		<pubDate>Sun, 27 Apr 2008 23:26:16 +0000</pubDate>
		<guid isPermaLink="false">http://thinkingdigitally.com/archive/eager-loading-with-ultrasphinx/#comment-83</guid>
		<description>&lt;p&gt;Thank you so much for addressing this issue.  Are you now able to do this for the example you use?&lt;/p&gt;

&lt;p&gt;@course = Ultrasphinx::Search.new(:query =&gt; params[:course_id])&lt;/p&gt;

&lt;p&gt;@professors = @course.professors?&lt;/p&gt;

&lt;p&gt;I am trying to do something similar in my program but haven&#039;t been able to access the associated fields (in your example, professors).&lt;/p&gt;

&lt;p&gt;Any feedback would be appreciated!&lt;/p&gt;

&lt;p&gt;Thanks!&lt;/p&gt;

&lt;p&gt;Cheri&lt;/p&gt;

&lt;p&gt;Cheri&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Thank you so much for addressing this issue.  Are you now able to do this for the example you use?</p>

<p>@course = Ultrasphinx::Search.new(:query =&gt; params[:course_id])</p>

<p>@professors = @course.professors?</p>

<p>I am trying to do something similar in my program but haven&#8217;t been able to access the associated fields (in your example, professors).</p>

<p>Any feedback would be appreciated!</p>

<p>Thanks!</p>

<p>Cheri</p>

<p>Cheri</p>]]></content:encoded>
	</item>
</channel>
</rss>

