Index: contrib/apachesolr_mlt/apachesolr_mlt.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/apachesolr/contrib/apachesolr_mlt/Attic/apachesolr_mlt.module,v
retrieving revision 1.1.4.26
diff -u -p -r1.1.4.26 apachesolr_mlt.module
--- contrib/apachesolr_mlt/apachesolr_mlt.module	20 Mar 2009 03:53:30 -0000	1.1.4.26
+++ contrib/apachesolr_mlt/apachesolr_mlt.module	25 Mar 2009 00:43:00 -0000
@@ -40,7 +40,7 @@ function apachesolr_mlt_block($op = 'lis
     $blocks = apachesolr_mlt_list_blocks();
     return $blocks;
   }
-  else if ($op == 'view' && !empty($delta) && (arg(0) == 'node')) {
+  elseif ($op == 'view' && !empty($delta) && (arg(0) == 'node')) {
     //return the content of the block, based on the delta
     $nid = arg(1);
     if (is_numeric($nid) && (!arg(2) || arg(2) == 'view')) {
@@ -85,10 +85,7 @@ function apachesolr_mlt_suggestions($blo
       }
     }
     $query = apachesolr_drupal_query('id:' . apachesolr_document_id($nid));
-    if (empty($query)) {
-      // An error contacting the server.
-      return;
-    }
+
     // This hook allows modules to modify the query and params objects.
     apachesolr_modify_query($query, $params, 'apachesolr_mlt');
     if (empty($query)) {
@@ -98,39 +95,36 @@ function apachesolr_mlt_suggestions($blo
     $response = $solr->search($query->get_query_basic(), 0, $block['num_results'], $params);
     $suggestions = array();
     if ($response->response) {
-      $r = (array) end($response->response);
-      $links = array();
-
-      if (is_array($r)) {
-        foreach ($r as $result) {
-          // Suitable for single-site mode.
-          $links[] = l($result->title, 'node/' . $result->nid);
-        }
-      }
-
-      if (count($links)) {
+      $docs = (array) end($response->response);
+      if (!empty($docs)) {
         $suggestions['subject'] = check_plain($block['name']);
-        $suggestions['content'] = theme('apachesolr_mlt_recommendation_block', $links);
+        $suggestions['content'] = theme('apachesolr_mlt_recommendation_block', $docs);
         if (user_access('administer search')) {
            $suggestions['content'] .= l(t('Configure this block'),'admin/settings/apachesolr/mlt/configure_block/' . $delta, array('attributes' => array('class' => 'apachesolr-mlt-admin-link')));
         }
       }
     }
     return $suggestions;
-  } catch ( Exception $e ) {
-      watchdog('Apache Solr', $e->getMessage(), NULL, WATCHDOG_ERROR );
+  } 
+  catch ( Exception $e ) {
+    watchdog('Apache Solr', $e->getMessage(), NULL, WATCHDOG_ERROR );
   }
 }
 
 function apachesolr_mlt_theme($existing, $type, $theme, $path) {
   return array(
     'apachesolr_mlt_recommendation_block' => array(
-      'arguments' => array('links' => NULL),
+      'arguments' => array('docs' => NULL),
     ),
   );
 }
 
-function theme_apachesolr_mlt_recommendation_block($links) {
+function theme_apachesolr_mlt_recommendation_block($docs) {
+  $links = array();
+  foreach ($docs as $result) {
+    // Suitable for single-site mode.
+    $links[] = l($result->title, 'node/' . $result->nid);
+  }
   return theme('item_list', $links);
 }
 
