public function fromPage(TypoScriptFrontendController $page, $url, Rootline $pageAccessRootline, $mountPointParameter): Document
    {
        /* @var $document Document */
        $document = GeneralUtility::makeInstance(Document::class);
        $site = $this->getSiteByPageId($page->id);
        $pageRecord = $page->page;

        $accessGroups = $this->getDocumentIdGroups($pageAccessRootline);
        $documentId = $this->getPageDocumentId($page, $accessGroups, $mountPointParameter);

        $document->setField('id', $documentId);
        $document->setField('site', $site->getDomain());
        $document->setField('siteHash', $site->getSiteHash());
        $document->setField('appKey', 'EXT:solr');
        $document->setField('type', 'pages');

        // system fields
        $document->setField('uid', $page->id);
        $document->setField('pid', $pageRecord['pid']);

        // variantId
        $variantId = $this->variantIdBuilder->buildFromTypeAndUid('pages', $page->id);
        $document->setField('variantId', $variantId);

        $document->setField('typeNum', $page->type);
        $document->setField('created', $pageRecord['crdate']);
        $document->setField('changed', $pageRecord['SYS_LASTCHANGED']);

        $rootline = $this->getRootLineFieldValue($page->id, $mountPointParameter);
        $document->setField('rootline', $rootline);

        // access
        $this->addAccessField($document, $pageAccessRootline);
        $this->addEndtimeField($document, $pageRecord);

        // content
        $contentExtractor = $this->getExtractorForPageContent($page->content);
        $document->setField('title', $contentExtractor->getPageTitle());
        $document->setField('subTitle', $pageRecord['subtitle']);
        $document->setField('navTitle', $pageRecord['nav_title']);
        $document->setField('author', $pageRecord['author']);
        $document->setField('description', $pageRecord['description']);
        $document->setField('abstract', $pageRecord['abstract']);
        $document->setField('content', $contentExtractor->getIndexableContent());
        $document->setField('url', $url);

        $this->addKeywordsField($document, $pageRecord);
        $this->addTagContentFields($document, $contentExtractor->getTagContent());

        return $document;
    }
public function fromPage(TypoScriptFrontendController $page, $url, Rootline $pageAccessRootline, $mountPointParameter): Document
    {
        /* @var $document Document */
        $document = GeneralUtility::makeInstance(Document::class);
        $site = $this->getSiteByPageId($page->id);
        $pageRecord = $page->page;

        $accessGroups = $this->getDocumentIdGroups($pageAccessRootline);
        $documentId = $this->getPageDocumentId($page, $accessGroups, $mountPointParameter);

        $document->setField('id', $documentId);
        $document->setField('site', $site->getDomain());
        $document->setField('siteHash', $site->getSiteHash());
        $document->setField('appKey', 'EXT:solr');
        $document->setField('type', 'pages');

        // system fields
        $document->setField('uid', $page->id);
        $document->setField('pid', $pageRecord['pid']);

        // variantId
        $variantId = $this->variantIdBuilder->buildFromTypeAndUid('pages', $page->id);
        $document->setField('variantId', $variantId);

        $document->setField('typeNum', $page->type);
        $document->setField('created', $pageRecord['crdate']);
        $document->setField('changed', $pageRecord['SYS_LASTCHANGED']);

        $rootline = $this->getRootLineFieldValue($page->id, $mountPointParameter);
        $document->setField('rootline', $rootline);

        // access
        $this->addAccessField($document, $pageAccessRootline);
        $this->addEndtimeField($document, $pageRecord);

        // content
        $contentExtractor = $this->getExtractorForPageContent($page->content);
        $document->setField('title', $contentExtractor->getPageTitle());
        $document->setField('subTitle', $pageRecord['subtitle']);
        $document->setField('navTitle', $pageRecord['nav_title']);
        $document->setField('author', $pageRecord['author']);
        $document->setField('description', $pageRecord['description']);
        $document->setField('abstract', $pageRecord['abstract']);
        $document->setField('content', $contentExtractor->getIndexableContent());
        $document->setField('url', $url);

        $this->addKeywordsField($document, $pageRecord);
        $this->addTagContentFields($document, $contentExtractor->getTagContent());

        return $document;
    }
public function fromPage ( TypoScriptFrontendController $ page , $ url , Rootline $ pageAccessRootline , $ mountPointParameter ) : Document { /* @var $document Document */ $ document = GeneralUtility :: makeInstance ( Document :: class ) ; $ site = $ this -> getSiteByPageId ( $ page -> id ) ; $ pageRecord = $ page -> page ; $ accessGroups = $ this -> getDocumentIdGroups ( $ pageAccessRootline ) ; $ documentId = $ this -> getPageDocumentId ( $ page , $ accessGroups , $ mountPointParameter ) ; $ document -> setField ( 'id' , $ documentId ) ; $ document -> setField ( 'site' , $ site -> getDomain ( ) ) ; $ document -> setField ( 'siteHash' , $ site -> getSiteHash ( ) ) ; $ document -> setField ( 'appKey' , 'EXT:solr' ) ; $ document -> setField ( 'type' , 'pages' ) ; // system fields $ document -> setField ( 'uid' , $ page -> id ) ; $ document -> setField ( 'pid' , $ pageRecord [ 'pid' ] ) ; // variantId $ variantId = $ this -> variantIdBuilder -> buildFromTypeAndUid ( 'pages' , $ page -> id ) ; $ document -> setField ( 'variantId' , $ variantId ) ; $ document -> setField ( 'typeNum' , $ page -> type ) ; $ document -> setField ( 'created' , $ pageRecord [ 'crdate' ] ) ; $ document -> setField ( 'changed' , $ pageRecord [ 'SYS_LASTCHANGED' ] ) ; $ rootline = $ this -> getRootLineFieldValue ( $ page -> id , $ mountPointParameter ) ; $ document -> setField ( 'rootline' , $ rootline ) ; // access $ this -> addAccessField ( $ document , $ pageAccessRootline ) ; $ this -> addEndtimeField ( $ document , $ pageRecord ) ; // content $ contentExtractor = $ this -> getExtractorForPageContent ( $ page -> content ) ; $ document -> setField ( 'title' , $ contentExtractor -> getPageTitle ( ) ) ; $ document -> setField ( 'subTitle' , $ pageRecord [ 'subtitle' ] ) ; $ document -> setField ( 'navTitle' , $ pageRecord [ 'nav_title' ] ) ; $ document -> setField ( 'author' , $ pageRecord [ 'author' ] ) ; $ document -> setField ( 'description' , $ pageRecord [ 'description' ] ) ; $ document -> setField ( 'abstract' , $ pageRecord [ 'abstract' ] ) ; $ document -> setField ( 'content' , $ contentExtractor -> getIndexableContent ( ) ) ; $ document -> setField ( 'url' , $ url ) ; $ this -> addKeywordsField ( $ document , $ pageRecord ) ; $ this -> addTagContentFields ( $ document , $ contentExtractor -> getTagContent ( ) ) ; return $ document ; }
This method can be used to build an Document from a TYPO3 page.

@param TypoScriptFrontendController $page
@param string $url
@param Rootline $pageAccessRootline
@param string $mountPointParameter
@return Document|object
This method can be used to build an Document from a TYPO3 page .