protected function _parseData()
	{
		//An alternative would be to use Zend_Json::decode(...)
		$data = json_decode($this->_response->getBody());

		// check that we receive a valid JSON response - we should never receive a null
		if ($data === null)
		{
			throw new Apache_Solr_ParserException('Solr response does not appear to be valid JSON, please examine the raw response with getRawResponse() method');
		}

		//if we're configured to collapse single valued arrays or to convert them to Apache_Solr_Document objects
		//and we have response documents, then try to collapse the values and / or convert them now
		if (($this->_createDocuments || $this->_collapseSingleValueArrays) && isset($data->response) && is_array($data->response->docs))
		{
			$documents = array();

			foreach ($data->response->docs as $originalDocument)
			{
				if ($this->_createDocuments)
				{
					$document = new Apache_Solr_Document();
				}
				else
				{
					$document = $originalDocument;
				}

				foreach ($originalDocument as $key => $value)
				{
					//If a result is an array with only a single
					//value then its nice to be able to access
					//it as if it were always a single value
					if ($this->_collapseSingleValueArrays && is_array($value) && count($value) <= 1)
					{
						$value = array_shift($value);
					}

					$document->$key = $value;
				}

				$documents[] = $document;
			}

			$data->response->docs = $documents;
		}

		$this->_parsedData = $data;
	}
protected function _parseData()
	{
		//An alternative would be to use Zend_Json::decode(...)
		$data = json_decode($this->_response->getBody());

		// check that we receive a valid JSON response - we should never receive a null
		if ($data === null)
		{
			throw new Apache_Solr_ParserException('Solr response does not appear to be valid JSON, please examine the raw response with getRawResponse() method');
		}

		//if we're configured to collapse single valued arrays or to convert them to Apache_Solr_Document objects
		//and we have response documents, then try to collapse the values and / or convert them now
		if (($this->_createDocuments || $this->_collapseSingleValueArrays) && isset($data->response) && is_array($data->response->docs))
		{
			$documents = array();

			foreach ($data->response->docs as $originalDocument)
			{
				if ($this->_createDocuments)
				{
					$document = new Apache_Solr_Document();
				}
				else
				{
					$document = $originalDocument;
				}

				foreach ($originalDocument as $key => $value)
				{
					//If a result is an array with only a single
					//value then its nice to be able to access
					//it as if it were always a single value
					if ($this->_collapseSingleValueArrays && is_array($value) && count($value) <= 1)
					{
						$value = array_shift($value);
					}

					$document->$key = $value;
				}

				$documents[] = $document;
			}

			$data->response->docs = $documents;
		}

		$this->_parsedData = $data;
	}
protected function _parseData ( ) { //An alternative would be to use Zend_Json::decode(...) $ data = json_decode ( $ this -> _response -> getBody ( ) ) ; // check that we receive a valid JSON response - we should never receive a null if ( $ data === null ) { throw new Apache_Solr_ParserException ( 'Solr response does not appear to be valid JSON, please examine the raw response with getRawResponse() method' ) ; } //if we're configured to collapse single valued arrays or to convert them to Apache_Solr_Document objects //and we have response documents, then try to collapse the values and / or convert them now if ( ( $ this -> _createDocuments || $ this -> _collapseSingleValueArrays ) && isset ( $ data -> response ) && is_array ( $ data -> response -> docs ) ) { $ documents = array ( ) ; foreach ( $ data -> response -> docs as $ originalDocument ) { if ( $ this -> _createDocuments ) { $ document = new Apache_Solr_Document ( ) ; } else { $ document = $ originalDocument ; } foreach ( $ originalDocument as $ key => $ value ) { //If a result is an array with only a single //value then its nice to be able to access //it as if it were always a single value if ( $ this -> _collapseSingleValueArrays && is_array ( $ value ) && count ( $ value ) <= 1 ) { $ value = array_shift ( $ value ) ; } $ document -> $ key = $ value ; } $ documents [ ] = $ document ; } $ data -> response -> docs = $ documents ; } $ this -> _parsedData = $ data ; }
Parse the raw response into the parsed_data array for access

@throws Apache_Solr_ParserException If the data could not be parsed
Parse the raw response into the parsed_data array for access