Index: apachesolr_search.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/apachesolr/apachesolr_search.module,v
retrieving revision 1.1.2.6.2.93
diff -u -p -r1.1.2.6.2.93 apachesolr_search.module
--- apachesolr_search.module	5 Jun 2009 12:34:36 -0000	1.1.2.6.2.93
+++ apachesolr_search.module	6 Jun 2009 10:01:36 -0000
@@ -614,31 +614,42 @@ function apachesolr_search_get_type($fac
  */
 function apachesolr_search_form_search_form_alter(&$form, $form_state) {
 
-  if (($form['module']['#value'] == 'apachesolr_search') && variable_get('apachesolr_search_spellcheck', FALSE) && apachesolr_has_searched() && ($response = apachesolr_static_response_cache())) {
-    //Get spellchecker suggestions into an array.
-    $suggestions = get_object_vars($response->spellcheck->suggestions);
-
-    if ($suggestions) {
-      //Get the original query and replace words.
-      $query = apachesolr_current_query();
-
-      foreach($suggestions as $word => $value) {
-        $replacements[$word] = $value->suggestion[0];
+  if ($form['module']['#value'] == 'apachesolr_search') {
+    if (variable_get('apachesolr_search_spellcheck', FALSE) && apachesolr_has_searched() && ($response = apachesolr_static_response_cache())) {
+      //Get spellchecker suggestions into an array.
+      $suggestions = get_object_vars($response->spellcheck->suggestions);
+  
+      if ($suggestions) {
+        //Get the original query and replace words.
+        $query = apachesolr_current_query();
+  
+        foreach($suggestions as $word => $value) {
+          $replacements[$word] = $value->suggestion[0];
+        }
+        $new_keywords = strtr($query->get_query_basic(), $replacements);
+  
+        $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)),
+        );
       }
-      $new_keywords = strtr($query->get_query_basic(), $replacements);
-
-      $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)),
-      );
     }
+    $form['#submit'][] = 'apachesolr_search_form_search_submit';    
   }
 }
 
 /**
+ * Process a block search form submission.
+ */
+function apachesolr_search_form_search_submit($form, &$form_state) {
+  $form_id = $form['form_id']['#value'];
+  $form_state['values']['processed_keys'] = urlencode(trim($form_state['values']['processed_keys']));
+}
+
+/**
  * Implementation of hook_form_[form_id]_alter().
  *
  * This adds spelling suggestions to the search form.
