diff --git a/apachesolr_search.module b/apachesolr_search.module
index cc07c09..430b41c 100644
--- a/apachesolr_search.module
+++ b/apachesolr_search.module
@@ -899,7 +899,9 @@ function apachesolr_search_search_results($keys = NULL, $conditions = NULL, $sea
       // Full text behavior. Triggers with a text search or a facet
       elseif (($keys || isset($conditions['f'])) || ($empty_search_behavior == 'results')) {
         // Don't allow local params to pass through to EDismax from the url.
-        $keys = preg_replace('/^(?:{![^}]*}\s*)+/',' ', $keys);
+        // We also remove any remaining leading {! since that causes a parse
+        // error in Solr.
+        $keys = preg_replace('/^(?:{![^}]*}\s*)+(?:{!\s*)*/',' ', $keys);
         $params['q'] = $keys;
         // Hardcoded apachesolr name since we rely on this for the facets
         $context['page_id'] = $search_page['page_id'];
