--- /opt/lampp/htdocs/sites/default/modules/contrib/apachesolr/apachesolr_search.module	2010-08-06 14:23:10.877943721 +0100
+++ /home/tphethean/Documents/apachesolr_backup/apachesolr_search.module	2010-08-06 12:51:20.637939000 +0100
@@ -951,32 +951,24 @@
         $suggestions = get_object_vars($response->spellcheck->suggestions);
         if ($suggestions) {
 
+
           // Get the original query and replace words.
           $query = apachesolr_current_query();
 
-          // The actual suggestions are an array within the object returned by SOLR
-          // Allow more than one suggestion to be returned if spellcheck.count in SOLR is greater than 1
-          $suggestions = ($suggestions[$query->get_query_basic()]->suggestion);
-                 
-          // Is one of the suggestions the phrase that was searched for?
-          $ar_search = array_search($query->get_query_basic(),$suggestions);
-          if($ar_search){
-            $unset($suggestions[$ar_search]);
+          foreach ($suggestions as $word => $value) {
+            $replacements[$word] = $value->suggestion[0];
           }
-          
-          // Show only if suggestions are different to current query.
-          if(count($suggestions) > 0 ){
-              foreach($suggestions as $suggestion){
-                $new_keywords .= l($suggestion, $query->get_path($suggestion)) . ', ';
-              }
-
-              $form['basic']['suggestion'] = array(
-                  '#prefix' => '<div class="spelling-suggestions">',
-                  '#suffix' => '</div>',
-                  '#type' => 'item',
-                  '#title' => t('Did you mean'),
-                  '#value' => $new_keywords,
-              );
+          $new_keywords = strtr($query->get_query_basic(), $replacements);
+
+          // Show only if suggestion is different than current query.
+          if ($query->get_query_basic() != $new_keywords) {
+            $form['basic']['suggestion'] = array(
+              '#prefix' => '<div class="spelling-suggestions">',
+              '#suffix' => '</div>',
+              '#type' => 'item',
+              '#title' => t('Did you mean'),
+              '#value' => l($new_keywords, $query->get_path($new_keywords)),
+            );
           }
         }
       }
