diff --git a/apachesolr.module b/apachesolr.module
index a0462e3..987ea6b 100644
--- a/apachesolr.module
+++ b/apachesolr.module
@@ -530,7 +530,7 @@ function apachesolr_failure($search_name, $querystring) {
       // If we're failing over to another module make sure the search is available.
       if (module_exists('search')) {
           drupal_set_message(t("%search_name is not available. Your search is being redirected.", array('%search_name' => $search_name)));
-          drupal_goto('search/node/' . drupal_encode_path($querystring));
+          drupal_goto('search/node/' . drupal_urlencode($querystring));
       }
       // if search is not enabled, break and do nothing
       break;
@@ -1109,7 +1109,7 @@ function apachesolr_get_solr($env_id = NULL, $reset = FALSE) {
       $class = $environments[$env_id]['service_class'];
     }
     $class = apachesolr_load_service_class($class, $class_info);
-    
+
     if (empty($solr_cache[$env_id])) {
       $solr = new $class($environments[$env_id]['url'], $env_id);
       $solr_cache[$env_id] = $solr;
@@ -1603,7 +1603,7 @@ function apachesolr_do_query(DrupalSolrQueryInterface $current_query) {
     // A module implementing HOOK_apachesolr_query_alter() aborted the search.
     return array(NULL, array());
   }
-  
+
 
   $keys = $query->getParam('q');
 
@@ -2612,7 +2612,7 @@ function apachesolr_environment_load_subrecords(&$environments) {
     extract($all_variables_result);
     $variables[$env_id][$name] = unserialize($value);
   }
-  
+
   foreach ($environments as $env_id => &$environment) {
     $index_bundles = !empty($all_index_bundles_keyed[$env_id]) ? $all_index_bundles_keyed[$env_id] : array();
     $conf = !empty($variables[$env_id]) ? $variables[$env_id] : array();
diff --git a/apachesolr_search.install b/apachesolr_search.install
index f8d1b69..32ff88e 100644
--- a/apachesolr_search.install
+++ b/apachesolr_search.install
@@ -179,3 +179,16 @@ function apachesolr_search_uninstall() {
   // Remove tables.
   drupal_uninstall_schema('apachesolr_search');
 }
+
+/**
+ * Remove all apachesolr_search env variables for show_facets if it is zero
+ */
+function apachesolr_search_update_7006() {
+  $environments = apachesolr_load_all_environments(TRUE);
+  foreach ($environments as $environment) {
+    $show_facets = apachesolr_environment_variable_get($environment['env_id'], 'apachesolr_search_show_facets', 0);
+    if ($show_facets === 0) {
+      apachesolr_environment_variable_del($environment['env_id'], 'apachesolr_search_show_facets');
+    }
+  }
+}
diff --git a/apachesolr_search.module b/apachesolr_search.module
index 83792d5..563308d 100644
--- a/apachesolr_search.module
+++ b/apachesolr_search.module
@@ -13,6 +13,23 @@
  * displayed.
  */
 function apachesolr_search_init() {
+  // Useless without facetapi
+  if (!module_exists('facetapi')) {
+    return;
+  }
+
+  // Using a simple query we will figure out if we have to execute this snippet
+  // on every page or exit as fast as possible.
+  $query = "SELECT count(env_id)
+    FROM {apachesolr_environment_variable}
+    WHERE name = 'apachesolr_search_show_facets'";
+  $count = db_result(db_query($query));
+  if ($count == 0) {
+    return;
+  }
+
+  // Load the default search page, we only support facets to link to this
+  // search page due to complexity and slow downs
   $search_page_id = apachesolr_search_default_search_page();
   $search_page = apachesolr_search_page_load($search_page_id);
   // Do not continue if our search page is not valid
@@ -21,31 +38,35 @@ function apachesolr_search_init() {
   }
 
   $show_facets = apachesolr_environment_variable_get($search_page['env_id'], 'apachesolr_search_show_facets', 0);
-  if ($show_facets && module_exists('facetapi')) {
+  if ($show_facets) {
 
     // Converts current path to lowercase for case insensitive matching.
-    $path = drupal_strtolower(drupal_get_path_alias($_GET['q']));
+    $paths = array();
+    $paths[] = drupal_strtolower(drupal_get_path_alias($_GET['q']));
+    $paths[] = drupal_strtolower($_GET['q']);
     $facet_pages = apachesolr_environment_variable_get($search_page['env_id'], 'apachesolr_search_facet_pages', '');
 
     // Iterates over each environment to check if an empty query should be run.
     if (!empty($facet_pages)) {
       // Compares path with settings, runs query if there is a match.
       $patterns = drupal_strtolower($facet_pages);
-      if (drupal_match_path($path, $patterns)) {
-        try {
-          if (!empty($search_page['search_path'])) {
-            $solr = apachesolr_get_solr($search_page['env_id']);
-            // Initializes params for empty query.
-            $params = array(
-              'spellcheck' => 'false',
-              'fq' => array(),
-              'rows' => 1,
-            );
-            apachesolr_search_run_empty('apachesolr', $params, $search_page['search_path'], $solr);
+      foreach ($paths as $path) {
+        if (drupal_match_path($path, $patterns)) {
+          try {
+            if (!empty($search_page['search_path'])) {
+              $solr = apachesolr_get_solr($search_page['env_id']);
+              // Initializes params for empty query.
+              $params = array(
+                'spellcheck' => 'false',
+                'fq' => array(),
+                'rows' => 1,
+              );
+              apachesolr_search_run_empty('apachesolr', $params, $search_page['search_path'], $solr);
+            }
+          }
+          catch (Exception $e) {
+            watchdog('Apache Solr', nl2br(check_plain($e->getMessage())), NULL, WATCHDOG_ERROR);
           }
-        }
-        catch (Exception $e) {
-          watchdog('Apache Solr', nl2br(check_plain($e->getMessage())), NULL, WATCHDOG_ERROR);
         }
       }
     }
@@ -341,7 +362,7 @@ function apachesolr_search_apachesolr_default_environment($env_id, $old_env_id)
  * @return array
  */
 function apachesolr_search_page_load($page_id, $reset = FALSE) {
-  $search_pages = apachesolr_search_load_all_search_pages();
+  $search_pages = apachesolr_search_load_all_search_pages($reset);
   if (!empty($search_pages[$page_id])) {
     return $search_pages[$page_id];
   }
@@ -502,8 +523,20 @@ function apachesolr_search_block_save($delta = '', $edit = array()) {
  * @return array $search_pages
  *   Array of all search pages
  */
-function apachesolr_search_load_all_search_pages() {
-  $search_pages = array();
+function apachesolr_search_load_all_search_pages($reset = FALSE) {
+  static $search_pages = array();
+
+  if ($reset) {
+    $search_pages = array();
+    if (module_exists('ctools')) {
+      ctools_include('export');
+      ctools_export_load_object_reset('apachesolr_search_page');
+    }
+  }
+
+  if (!empty($search_pages)) {
+    return $search_pages;
+  }
   // Get all search_pages and their id
   if (db_table_exists('apachesolr_search_page')) {
     // If ctools module is enabled, add search pages from code, e.g. from a
@@ -1638,7 +1671,15 @@ function apachesolr_search_facetapi_realm_settings_form_submit(&$form, &$form_st
   // Adds the settings to the array keyed by environment ID, saves variables.
   $show_facets = $form_state['values']['apachesolr_search_show_facets'];
   $facet_pages = $form_state['values']['apachesolr_search_facet_pages'];
-  apachesolr_environment_variable_set($env_id, 'apachesolr_search_show_facets', $show_facets);
+  if ($show_facets) {
+    apachesolr_environment_variable_set($env_id, 'apachesolr_search_show_facets', $show_facets);
+  }
+  else {
+    // Due to performance reasons, we delete it from the vars so that our init
+    // process can react on environments that hae it set and not unset.
+    // See apachesolr_search_init().
+    apachesolr_environment_variable_del($env_id, 'apachesolr_search_show_facets');
+  }
   apachesolr_environment_variable_set($env_id, 'apachesolr_search_facet_pages', $facet_pages);
 }
 
diff --git a/tests/apachesolr_base.test b/tests/apachesolr_base.test
index e62e139..3100373 100644
--- a/tests/apachesolr_base.test
+++ b/tests/apachesolr_base.test
@@ -278,6 +278,7 @@ class DrupalSolrOfflineSearchPagesWebTestCase extends DrupalWebTestCase {
     $this->assertResponse(200);
     // Reset static var
     apachesolr_search_page_load('core_search', TRUE);
+
     $this->drupalGet('admin/settings/apachesolr/search-pages');
     $this->assertText(t('Test Search Page'), t('Search page was succesfully edited'));
     $this->assertText('search/searchdifferentpath', t('Search path was updated'));
