diff --git a/recommender.views.inc b/recommender.views.inc
index 3a3914c..f302cc5 100644
--- a/recommender.views.inc
+++ b/recommender.views.inc
@@ -305,3 +305,179 @@ class views_handler_relationship_recommender_entity_type extends views_handler_r
     );
   }
 }
+
+/**
+ * Relationship handler to join onto a new base via the Recommender API's
+ * {recommender_similarity} table.
+ *
+ * In effect, gets you from 'foo' to 'bar similar to this foo'.
+ *
+ * Definition items:
+ *  - 'recommender app': The recommender app to use for this relationship.
+ *  - 'base' and 'base field': As with the parent class, defines the right
+ *     hand side of this relationship.
+ */
+class views_handler_relationship_recommender_similarity extends views_handler_relationship {
+
+  /**
+   * Called to implement a relationship in a query.
+   */
+  function query() {
+
+    // Join the second table first.
+    $this->ensure_my_table();
+    $def = $this->definition;
+
+    if (!empty($def['join_handler']) && class_exists($def['join_handler'])) {
+      $join = new $def['join_handler'];
+    }
+    else {
+      $join = new views_join();
+    }
+
+    $join->definition = array(
+      'table' => 'recommender_similarity',
+      'field' => 'source_eid',
+      'left_table' => $this->table_alias,
+      'left_field' => $this->real_field,
+      'type' => !empty($this->options['required']) ? 'INNER' : 'LEFT',
+    );
+    $join->construct();
+    $join->adjusted = TRUE;
+
+    $alias = $join->definition['table'] . '_' . $join->definition['left_table'];
+
+    $this->first_join = $this->query->add_relationship($alias, $join, $this->definition['base'], $this->relationship);
+
+    $this->query->add_orderby($this->first_join, 'score', 'DESC');
+
+    if (!empty($def['join_handler']) && class_exists($def['join_handler'])) {
+      $join = new $def['join_handler'];
+    }
+    else {
+      $join = new views_join();
+    }
+
+    $join->definition = array(
+      'table' => 'recommender_app',
+      'field' => 'id',
+      'left_table' => $this->first_join,
+      'left_field' => 'app_id',
+      'type' => !empty($this->options['required']) ? 'INNER' : 'LEFT',
+    );
+    $join->construct();
+    $join->adjusted = TRUE;
+
+    $this->second_join = $this->query->add_table('recommender_app', $this->first_join, $join);
+
+    $this->query->add_where($this->relationship, $this->second_join . '.name', $def['recommender app']);
+
+    // Figure out what base table this relationship brings to the party.
+    $table_data = views_fetch_data($this->definition['base']);
+    $base_field = empty($this->definition['base field']) ? $table_data['table']['base']['field'] : $this->definition['base field'];
+
+    if (!empty($def['join_handler']) && class_exists($def['join_handler'])) {
+      $join = new $def['join_handler'];
+    }
+    else {
+      $join = new views_join();
+    }
+
+    $join->definition = array(
+      'table' => $def['base'],
+      'field' => $base_field,
+      'left_table' => $this->first_join,
+      'left_field' => 'target_eid',
+      'type' => !empty($this->options['required']) ? 'INNER' : 'LEFT',
+    );
+    $join->construct();
+    $join->adjusted = TRUE;
+
+    // use a short alias for this:
+    $alias = $join->definition['table'] . '_' . $join->definition['left_table'];
+
+    $this->alias = $this->query->add_relationship($alias, $join, $this->definition['base'], $this->relationship);
+  }
+}
+
+class views_handler_relationship_recommender_prediction extends views_handler_relationship {
+
+  /**
+   * Called to implement a relationship in a query.
+   */
+  function query() {
+    // Join the second table first.
+    $this->ensure_my_table();
+    $def = $this->definition;
+
+    if (!empty($def['join_handler']) && class_exists($def['join_handler'])) {
+      $join = new $def['join_handler'];
+    }
+    else {
+      $join = new views_join();
+    }
+
+    $join->definition = array(
+      'table' => 'recommender_prediction',
+      'field' => 'target_eid',
+      'left_table' => $this->table_alias,
+      'left_field' => $def['target eid'],
+      'type' => !empty($this->options['required']) ? 'INNER' : 'LEFT',
+    );
+    $join->construct();
+    $join->adjusted = TRUE;
+
+    $alias = $join->definition['table'] . '_' . $join->definition['left_table'];
+
+    $this->first_join = $this->query->add_relationship($alias, $join, $this->definition['base'], $this->relationship);
+
+    $this->query->add_orderby($this->first_join, 'score', 'DESC');
+
+    if (!empty($def['join_handler']) && class_exists($def['join_handler'])) {
+      $join = new $def['join_handler'];
+    }
+    else {
+      $join = new views_join();
+    }
+
+    $join->definition = array(
+      'table' => 'recommender_app',
+      'field' => 'id',
+      'left_table' => $this->first_join,
+      'left_field' => 'app_id',
+      'type' => !empty($this->options['required']) ? 'INNER' : 'LEFT',
+    );
+    $join->construct();
+    $join->adjusted = TRUE;
+
+    $this->second_join = $this->query->add_table('recommender_app', $this->first_join, $join);
+
+    $this->query->add_where($this->relationship, $this->second_join . '.name', $def['recommender app']);
+
+    // Figure out what base table this relationship brings to the party.
+    $table_data = views_fetch_data($this->definition['base']);
+    $base_field = empty($this->definition['base field']) ? $table_data['table']['base']['field'] : $this->definition['base field'];
+
+    if (!empty($def['join_handler']) && class_exists($def['join_handler'])) {
+      $join = new $def['join_handler'];
+    }
+    else {
+      $join = new views_join();
+    }
+
+    $join->definition = array(
+      'table' => $def['base'],
+      'field' => $base_field,
+      'left_table' => $this->first_join,
+      'left_field' => 'source_eid',
+      'type' => !empty($this->options['required']) ? 'INNER' : 'LEFT',
+    );
+    $join->construct();
+    $join->adjusted = TRUE;
+
+    // use a short alias for this:
+    $alias = $join->definition['table'] . '_' . $join->definition['left_table'];
+
+    $this->alias = $this->query->add_relationship($alias, $join, $this->definition['base'], $this->relationship);
+  }
+}
