diff --git a/Solr_Base_Query.php b/Solr_Base_Query.php
index fadda8f..d09a173 100644
--- a/Solr_Base_Query.php
+++ b/Solr_Base_Query.php
@@ -313,32 +313,33 @@ class SolrBaseQuery extends SolrFilterSubQuery implements DrupalSolrQueryInterfa
   }
 
   protected function addFq($string, $index = NULL) {
-    // Gets information about the fields already in solr index.
     $string = trim($string);
     $local = '';
     $exclude = FALSE;
-    if (preg_match('/\({!([^}]+)\}(.*)/', $string, $matches)) {
+    $name = NULL;
+    $value = NULL;
+
+    // Check if we are dealing with an exclude
+    if(preg_match('/^-(.*)/', $string, $matches)) {
+      $exclude = TRUE;
+      $string = $matches[1];
+    }
+
+    // If {!something} is found as first character then this is a local value
+    if (preg_match('/\{!([^}]+)\}(.*)/', $string, $matches)) {
       $local = $matches[1];
       $string = $matches[2];
     }
-    if (preg_match('/(-|)(\(\S+\))/', $string, $matches)) {
-      // Something complicated
-      $exclude = !empty($matches[1]);
-      $this->addFilter('', $matches[2], $exclude, $local);
-    }
-    elseif (preg_match('/(-|)([^:]+):([\("\[].+[\)"\]])/', $string, $matches)) {
-      // Something with a complicated right-hand-side.
-      // Ex.: bundle:(article OR page)
-      // Ex.: title:"double words"
-      // Ex.: field_date:[1970-12-31T23:59:59Z TO NOW]
-      $exclude = !empty($matches[1]);
-      $this->addFilter($matches[2], $matches[3], $exclude, $local);
+
+    //Anything that has a name and value
+    // check if we have a : in the string
+    if(strstr($string, ':')) {
+      list($name, $value) = explode(":", $string, 2);
     }
-    elseif (preg_match('/(-|)([^:]+):(\S+)/', $string, $matches)) {
-      //$index_fields = (array) $this->solr->getFields();
-      $exclude = !empty($matches[1]);
-      $this->addFilter($matches[2], $matches[3], $exclude, $local);
+    else {
+      $value = $string;
     }
+    $this->addFilter($name, $value, $exclude, $local);
     return $this;
   }
 
diff --git a/tests/solr_base_query.test b/tests/solr_base_query.test
index f7a6787..a79ac91 100644
--- a/tests/solr_base_query.test
+++ b/tests/solr_base_query.test
@@ -24,23 +24,28 @@ $(document).ready(function(){
   $('.accordion_teachers').accordion({ collapsible:true, autoHeight:false });
 });
 </script>
+
 EOF;
 
     $this->embed_content = <<<EOF
 <p>GOOD_CONTENT</p>
 <object width="425" height="349"><param name="movie" value="http://www.youtube.com/v/8Vmnq5dBF7Y?version=3&amp;hl=en_US"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/8Vmnq5dBF7Y?version=3&amp;hl=en_US" type="application/x-shockwave-flash" width="425" height="349" allowscriptaccess="always" allowfullscreen="true"></embed></object>
 OTHER_CONTENT
+
 EOF;
 
     $this->iframe_content = <<<EOF
 <iframe width="425" height="349" src="http://www.youtube.com/embed/8Vmnq5dBF7Y" frameborder="0" allowfullscreen></iframe>
 <p><a href="#">GOOD_CONTENT</a></p><iframe></iframe>
+
 EOF;
 
     $this->comment_content = <<<EOF
 <p><em>GOOD_CONTENT</em></p><!-- COMMENT -->
 OTHER_CONTENT
+
 EOF;
+
   }
 
   /**
@@ -142,5 +147,88 @@ class SolrBaseQueryTests extends DrupalUnitTestCase {
     $this->assertEqual(count($query->getParam('fq')), 3, count($query->getParam('fq')) . ' fq params found, expected 3 after adding subquery');
     $this->assertEqual(array('sort_label:hello', 'label:hello', '(access__all:0 OR hash:' . apachesolr_site_hash() . ')'), $query->getParam('fq'));
   }
+
+  function testAddParams() {
+    $examples = array();
+    $examples['{!cache=false}inStock:true'] = array(
+      '#local' => 'cache=false',
+      '#exclude' => FALSE,
+      '#name' => 'inStock',
+      '#value' => 'true',
+    );
+    $examples['{!frange l=1 u=4 cache=false}sqrt(popularity)'] = array(
+      '#local' => 'frange l=1 u=4 cache=false',
+      '#exclude' => FALSE,
+      '#name' => NULL,
+      '#value' => 'sqrt(popularity)',
+    );
+    $examples['{!cache=false cost=5}inStock:true'] = array(
+      '#local' => 'cache=false cost=5',
+      '#exclude' => FALSE,
+      '#name' => 'inStock',
+      '#value' => 'true',
+    );
+    $examples['{!tag=impala}model:Impala'] = array(
+      '#local' => 'tag=impala',
+      '#exclude' => FALSE,
+      '#name' => 'model',
+      '#value' => 'Impala',
+    );
+    $examples['{!anything that appears to be local}'] = array(
+      '#local' => 'anything that appears to be local',
+      '#exclude' => FALSE,
+      '#name' => NULL,
+      '#value' => NULL,
+    );
+    $examples['bundle:(article OR page)'] = array(
+      '#local' => NULL,
+      '#exclude' => FALSE,
+      '#name' => 'bundle',
+      '#value' => '(article OR page)',
+    );
+    $examples['-bundle:(article OR page)'] = array(
+      '#local' => NULL,
+      '#exclude' => TRUE,
+      '#name' => 'bundle',
+      '#value' => '(article OR page)',
+    );
+    $examples['-{!anything that appears to be local}'] = array(
+      '#local' => 'anything that appears to be local',
+      '#exclude' => TRUE,
+      '#name' => NULL,
+      '#value' => NULL,
+    );
+    $examples['title:"double words"'] = array(
+      '#local' => NULL,
+      '#exclude' => FALSE,
+      '#name' => 'title',
+      '#value' => '"double words"',
+    );
+    $examples['field_date:[1970-12-31T23:59:59Z TO NOW]'] = array(
+      '#local' => NULL,
+      '#exclude' => FALSE,
+      '#name' => 'field_date',
+      '#value' => '[1970-12-31T23:59:59Z TO NOW]',
+    );
+    $query = new SolrBaseQuery("apachesolr_tests", new DummySolr());
+    foreach($examples as $fq => $example) {
+      $query->addParam('fq', $fq);
+      // Check if filter was added
+      $message = t('hasFilter(@name, @value) is True', array('@name' => $example['#name'], '@value' => $example['#value']));
+      $this->assertTrue($query->hasFilter($example['#name'], $example['#value'], $example['#exclude']), $message);
+      $filters = $query->getFilters();
+      $filter = reset($filters);
+      $message = t('The filter "@fq" was added with all the given properties', array('@fq' => $fq));
+      $this->assertTrue(!array_diff($example, $filter), $message);
+      $query->removeFilter($example['#name']);
+      $message = t('The filter "@fq" was correctly removed', array('@fq' => $fq));
+      $this->assertFalse($query->hasFilter($example['#name'], $example['#value'], $example['#exclude']), $message);
+      // Since we cannot remove filters without names yet we have to clear the whole fq array
+      $query->removeParam('fq');
+      // Check the ones without the name also
+    }
+  }
 }
 
+
+
