You are here

public function Apache_Solr_Document::setMultiValue in Apache Solr Search 5

Handle the array manipulation for a multi-valued field

Parameters

string $key:

string $value:

File

SolrPhpClient/Apache/Solr/Document.php, line 105

Class

Apache_Solr_Document
Holds Key / Value pairs that represent a Solr Document. Field values can be accessed by direct dereferencing such as: <code> ... $document->title = 'Something'; echo $document->title; ... </code>

Code

public function setMultiValue($key, $value) {
  if (!isset($this->_fields[$key])) {
    $this->_fields[$key] = array();
  }
  if (!is_array($this->_fields[$key])) {
    $this->_fields[$key] = array(
      $this->_fields[$key],
    );
  }
  $this->_fields[$key][] = $value;
}