You are here

function Solr_Base_Query::remove_field in Apache Solr Search 5

File

./Solr_Base_Query.php, line 123

Class

Solr_Base_Query

Code

function remove_field($name, $value = NULL) {

  // We can only remove named fields.
  if (empty($name)) {
    return;
  }
  if (empty($value)) {
    foreach ($this->_fields as $pos => $values) {
      if ($values['#name'] == $name) {
        unset($this->_fields[$pos]);
      }
    }
  }
  else {
    foreach ($this->_fields as $pos => $values) {
      if ($values['#name'] == $name && $values['#value'] == $value) {
        unset($this->_fields[$pos]);
      }
    }
  }
  $this
    ->rebuild_query();
}