diff --git a/sites/all/modules/apachesolr_multisitesearch/apachesolr_multisitesearch.module b/sites/all/modules/apachesolr_multisitesearch/apachesolr_multisitesearch.module
index bed0f91..1c07ace 100644
--- a/sites/all/modules/apachesolr_multisitesearch/apachesolr_multisitesearch.module
+++ b/sites/all/modules/apachesolr_multisitesearch/apachesolr_multisitesearch.module
@@ -471,3 +471,70 @@ function apachesolr_multisitesearch_apachesolr_delete_index_alter(&$query) {
   // Limit to the current site.
   $query = "($query) AND hash:" . apachesolr_site_hash();
 }
+
+/**
+ * Implementation of hook_form_[form_id]_alter().
+ *
+ * This adds spelling suggestions, retain filters to the search form.
+ */
+function apachesolr_multisitesearch_form_search_form_alter(&$form, $form_state) {
+  if ($form['module']['#value'] == 'apachesolr_multisitesearch') {
+    // No modification make sense unless a query is active.
+    // Note - this means that the query must always be run before
+    // calling drupal_get_form('search_form').
+    $apachesolr_has_searched = apachesolr_multisitesearch_has_searched();
+
+    $queryvalues = array();
+    if ($apachesolr_has_searched) {
+      $query = apachesolr_current_query();
+      $queryvalues = $query->get_url_queryvalues();
+    }
+
+    $form['basic']['apachesolr_search']['#tree'] = TRUE;
+    $form['basic']['apachesolr_search']['queryvalues'] = array(
+      '#type' => 'hidden',
+      // We use JSON encoding instead of PHP serialize, since otherwise we be
+      // at risk of user input being injected into the hidden string and
+      // unserialized.
+      '#default_value' => json_encode($queryvalues),
+    );
+    $form['basic']['apachesolr_search']['get'] = array(
+      '#type' => 'hidden',
+      '#default_value' => json_encode(array_diff_key($_GET, array('q' => 1, 'page' => 1, 'filters' => 1, 'solrsort' => 1, 'retain-filters' => 1))),
+    );
+    if ($queryvalues || isset($form_state['post']['apachesolr_search']['retain-filters'])) {
+      $form['basic']['apachesolr_search']['retain-filters'] = array(
+        '#type' => 'checkbox',
+        '#title' => t('Retain current filters'),
+        '#default_value' => (int) isset($_GET['retain-filters']),
+      );
+    }
+
+    if (variable_get('apachesolr_search_spellcheck', FALSE) && $apachesolr_has_searched && ($response = apachesolr_static_response_cache())) {
+      // Get spellchecker suggestions into an array.
+      if (isset($response->spellcheck->suggestions) && $response->spellcheck->suggestions) {
+        $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);
+
+          // 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)),
+            );
+          }
+        }
+      }
+    }
+  }
+}
