public function newFromElasticResults(Array $hit)
    {
        $instance = $this->newInstance(array(), true);

        $attributes = $hit['_source'];

        $instance->isDocument = true;

        if (isset($hit['_score'])) {
            $instance->documentScore = $hit['_score'];
        }

        if (isset($hit['_version'])) {
            $instance->documentVersion = $hit['_version'];
        }

        if (isset($hit['highlight'])) {
            foreach ($hit['highlight'] as $field => $value) {
                $instance->highlighted[$field] = $value[0];
            }
        }

        $instance->setRawAttributes($attributes, true);

        return $instance;
    }
public function newFromElasticResults(Array $hit)
    {
        $instance = $this->newInstance(array(), true);

        $attributes = $hit['_source'];

        $instance->isDocument = true;

        if (isset($hit['_score'])) {
            $instance->documentScore = $hit['_score'];
        }

        if (isset($hit['_version'])) {
            $instance->documentVersion = $hit['_version'];
        }

        if (isset($hit['highlight'])) {
            foreach ($hit['highlight'] as $field => $value) {
                $instance->highlighted[$field] = $value[0];
            }
        }

        $instance->setRawAttributes($attributes, true);

        return $instance;
    }
public function newFromElasticResults ( Array $ hit ) { $ instance = $ this -> newInstance ( array ( ) , true ) ; $ attributes = $ hit [ '_source' ] ; $ instance -> isDocument = true ; if ( isset ( $ hit [ '_score' ] ) ) { $ instance -> documentScore = $ hit [ '_score' ] ; } if ( isset ( $ hit [ '_version' ] ) ) { $ instance -> documentVersion = $ hit [ '_version' ] ; } if ( isset ( $ hit [ 'highlight' ] ) ) { foreach ( $ hit [ 'highlight' ] as $ field => $ value ) { $ instance -> highlighted [ $ field ] = $ value [ 0 ] ; } } $ instance -> setRawAttributes ( $ attributes , true ) ; return $ instance ; }
Fills a model's attributes with Elasticsearch
result data.

@param array $hit
@return mixed
Fills a model s attributes with Elasticsearch result data .