public function getDocumentById($documentId)
    {
        /* @var $query SearchQuery */
        $query = $this->queryBuilder->newSearchQuery($documentId)->useQueryFields(QueryFields::fromString('id'))->getQuery();
        $response = $this->search->search($query, 0, 1);
        $parsedData = $response->getParsedData();
        $resultDocument = isset($parsedData->response->docs[0]) ? $parsedData->response->docs[0] : null;

        if (!$resultDocument instanceof Document) {
            throw new \UnexpectedValueException("Response did not contain a valid Document object");
        }

        return $this->searchResultBuilder->fromApacheSolrDocument($resultDocument);
    }
public function getDocumentById($documentId)
    {
        /* @var $query SearchQuery */
        $query = $this->queryBuilder->newSearchQuery($documentId)->useQueryFields(QueryFields::fromString('id'))->getQuery();
        $response = $this->search->search($query, 0, 1);
        $parsedData = $response->getParsedData();
        $resultDocument = isset($parsedData->response->docs[0]) ? $parsedData->response->docs[0] : null;

        if (!$resultDocument instanceof Document) {
            throw new \UnexpectedValueException("Response did not contain a valid Document object");
        }

        return $this->searchResultBuilder->fromApacheSolrDocument($resultDocument);
    }
public function getDocumentById ( $ documentId ) { /* @var $query SearchQuery */ $ query = $ this -> queryBuilder -> newSearchQuery ( $ documentId ) -> useQueryFields ( QueryFields :: fromString ( 'id' ) ) -> getQuery ( ) ; $ response = $ this -> search -> search ( $ query , 0 , 1 ) ; $ parsedData = $ response -> getParsedData ( ) ; $ resultDocument = isset ( $ parsedData -> response -> docs [ 0 ] ) ? $ parsedData -> response -> docs [ 0 ] : null ; if ( ! $ resultDocument instanceof Document ) { throw new \ UnexpectedValueException ( "Response did not contain a valid Document object" ) ; } return $ this -> searchResultBuilder -> fromApacheSolrDocument ( $ resultDocument ) ; }
Retrieves a single document from solr by document id.

@param string $documentId
@return SearchResult
Retrieves a single document from solr by document id .