protected function getDocumentAsArray(SearchResult $document, $additionalTopResultsFields = []) : array
    {
        $fields = [
            'link' => $document->getUrl(),
            'type' => $document['type_stringS'] ? $document['type_stringS'] : $document->getType(),
            'title' => $document->getTitle(),
            'content' => $document->getContent(),
            'group' => $document->getHasGroupItem() ? $document->getGroupItem()->getGroupValue() : '',
            'previewImage' => $document['previewImage_stringS'] ? $document['previewImage_stringS'] : '',
        ];
        foreach ($additionalTopResultsFields as $additionalTopResultsField) {
            $fields[$additionalTopResultsField] = $document[$additionalTopResultsField] ? $document[$additionalTopResultsField] : '';
        }
        return $fields;
    }
protected function getDocumentAsArray(SearchResult $document, $additionalTopResultsFields = []) : array
    {
        $fields = [
            'link' => $document->getUrl(),
            'type' => $document['type_stringS'] ? $document['type_stringS'] : $document->getType(),
            'title' => $document->getTitle(),
            'content' => $document->getContent(),
            'group' => $document->getHasGroupItem() ? $document->getGroupItem()->getGroupValue() : '',
            'previewImage' => $document['previewImage_stringS'] ? $document['previewImage_stringS'] : '',
        ];
        foreach ($additionalTopResultsFields as $additionalTopResultsField) {
            $fields[$additionalTopResultsField] = $document[$additionalTopResultsField] ? $document[$additionalTopResultsField] : '';
        }
        return $fields;
    }
protected function getDocumentAsArray ( SearchResult $ document , $ additionalTopResultsFields = [ ] ) : array { $ fields = [ 'link' => $ document -> getUrl ( ) , 'type' => $ document [ 'type_stringS' ] ? $ document [ 'type_stringS' ] : $ document -> getType ( ) , 'title' => $ document -> getTitle ( ) , 'content' => $ document -> getContent ( ) , 'group' => $ document -> getHasGroupItem ( ) ? $ document -> getGroupItem ( ) -> getGroupValue ( ) : '' , 'previewImage' => $ document [ 'previewImage_stringS' ] ? $ document [ 'previewImage_stringS' ] : '' , ] ; foreach ( $ additionalTopResultsFields as $ additionalTopResultsField ) { $ fields [ $ additionalTopResultsField ] = $ document [ $ additionalTopResultsField ] ? $ document [ $ additionalTopResultsField ] : '' ; } return $ fields ; }
Creates an array representation of the result and returns it.

@param SearchResult $document
@param array $additionalTopResultsFields
@return array
Creates an array representation of the result and returns it .