<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -50,6 +50,9 @@ user = User.find(:first)
 user.similar_users #=&gt; [...]
 user.recommended_books #=&gt; [...]
 
+book = Book.find(:first)
+book.similar_books #=&gt; [...]
+
 Example 2
 =========
 
@@ -110,6 +113,7 @@ user.recommended_books #=&gt; [...]
 #
 # The advantage of using a dataset is that you don't need to load all the users &amp; items into
 # memory (which you do normally). The disadvantage is that you won't get as accurate results.
+#
 
 Contact
 =======</diff>
      <filename>README</filename>
    </modified>
    <modified>
      <diff>@@ -36,9 +36,15 @@ module MadeByMany
         
         class_inheritable_accessor :aar_options
         self.aar_options = options
+        
+        options[:on_class].class_eval do
+          define_method &quot;similar_#{options[:on]}&quot; do
+            Logic.similar_items(self, options)
+          end
+        end
 
         define_method &quot;similar_#{options[:class].name.underscore.pluralize}&quot; do
-          Logic.similar(self, options)
+          Logic.similar_users(self, options)
         end
           
         define_method &quot;recommended_#{options[:on_class].name.underscore.pluralize}&quot; do
@@ -67,7 +73,7 @@ module MadeByMany
             }.compact.inject({}) {|h, item| h[item.id] = item; h }
           end
         end
-        
+                
       end
     end
       
@@ -144,7 +150,7 @@ module MadeByMany
         num / den
       end
       
-      def self.similar(user, options)
+      def self.similar_users(user, options)
         rankings = []
         items, prefs = self.matrix(options)
         prefs.each do |u, _|
@@ -169,6 +175,43 @@ module MadeByMany
           user
         }
       end
+      
+      def self.similar_items(item, options)
+        if options[:use_dataset]
+          if options[:split_dataset]
+            rankings = Rails.cache.read(&quot;aar_#{options[:on]}_#{item.id}&quot;)
+          else
+            cached_dataset = Rails.cache.read(&quot;aar_#{options[:on]}_dataset&quot;)
+            logger.warn 'ActsRecommendable has an empty dataset - rebuild it' unless cached_dataset
+            rankings = cached_dataset &amp;&amp; cached_dataset[self.id]
+          end      
+        else
+          users, prefs = self.inverted_matrix(options)
+          rankings = []
+          prefs.each do |i, _|
+            next if i == item.id
+            rankings &lt;&lt; [self.__send__(options[:algorithm], prefs, users, item.id, i), i]
+          end
+        end
+        return [] unless rankings
+        
+        rankings = rankings.select {|score, _| score &gt; 0.0 }
+        rankings = rankings.sort_by {|score, _| score }.reverse
+        rankings = rankings[0..(options[:limit] - 1)]
+        
+        # Return the sorted list
+        ranking_ids = rankings.collect {|_, u| u }
+        ar_items = options[:on_class].find_some_without_failing(ranking_ids)
+        ar_items = ar_items.inject({}){ |h, item| h[item.id] = item; h }
+        
+        rankings.collect {|score, item_id|
+          item = ar_items[item_id]
+          def item.similar_score; return @similar_score; end
+          def item.similar_score=(d); @similar_score = d; end
+          item.similar_score = score
+          item
+        }
+      end
         
       def self.recommended(user, options)
         totals        = {}</diff>
      <filename>lib/acts_as_recommendable.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>e927612651e89cd298307fa666830abd06852353</id>
    </parent>
  </parents>
  <author>
    <name>Alex MacCaw</name>
    <email>maccman@gmail.com</email>
  </author>
  <url>http://github.com/maccman/acts_as_recommendable/commit/f30d171e2ec2194d18502f3e7f51b43b3f3200b8</url>
  <id>f30d171e2ec2194d18502f3e7f51b43b3f3200b8</id>
  <committed-date>2008-09-11T07:46:36-07:00</committed-date>
  <authored-date>2008-09-11T07:46:36-07:00</authored-date>
  <message>Add Book#similar_books</message>
  <tree>eb3d37a8c2433e6e0362cf629ff5c1d7e0b553a7</tree>
  <committer>
    <name>Alex MacCaw</name>
    <email>maccman@gmail.com</email>
  </committer>
</commit>
