src/Kunstmaan/NodeSearchBundle/Configuration/NodePagesConfiguration.php
protected function addPageToIndex(
        NodeTranslation $nodeTranslation,
        Node $node,
        NodeVersion $publicNodeVersion,
        HasNodeInterface $page
    ) {
        $rootNode = $this->currentTopNode;
        if (!$rootNode) {
            // Fetch main parent of current node...
            $rootNode = $this->em->getRepository('KunstmaanNodeBundle:Node')->getRootNodeFor(
                $node,
                $nodeTranslation->getLang()
            );
        }

        $doc = array(
            'root_id' => $rootNode->getId(),
            'node_id' => $node->getId(),
            'node_translation_id' => $nodeTranslation->getId(),
            'node_version_id' => $publicNodeVersion->getId(),
            'title' => $nodeTranslation->getTitle(),
            'slug' => $nodeTranslation->getFullSlug(),
            'page_class' => ClassLookup::getClass($page),
            'created' => $this->getUTCDateTime(
                $nodeTranslation->getCreated()
            )->format(\DateTime::ISO8601),
            'updated' => $this->getUTCDateTime(
                $nodeTranslation->getUpdated()
            )->format(\DateTime::ISO8601),
        );
        if ($this->logger) {
            $this->logger->info('Indexing document : ' . implode(', ', $doc));
        }

        // Permissions
        $this->addPermissions($node, $doc);

        // Search type
        $this->addSearchType($page, $doc);

        // Parent and Ancestors
        $this->addParentAndAncestors($node, $doc);

        // Content
        $this->addPageContent($nodeTranslation, $page, $doc);

        // Add document to index
        $uid = 'nodetranslation_' . $nodeTranslation->getId();

        $this->addCustomData($page, $doc);

        $this->documents[] = $this->searchProvider->createDocument(
            $uid,
            $doc,
            $this->indexName . '_' . $nodeTranslation->getLang(),
            $this->indexType
        );
    }
protected function addPageToIndex(
        NodeTranslation $nodeTranslation,
        Node $node,
        NodeVersion $publicNodeVersion,
        HasNodeInterface $page
    ) {
        $rootNode = $this->currentTopNode;
        if (!$rootNode) {
            // Fetch main parent of current node...
            $rootNode = $this->em->getRepository('KunstmaanNodeBundle:Node')->getRootNodeFor(
                $node,
                $nodeTranslation->getLang()
            );
        }

        $doc = array(
            'root_id' => $rootNode->getId(),
            'node_id' => $node->getId(),
            'node_translation_id' => $nodeTranslation->getId(),
            'node_version_id' => $publicNodeVersion->getId(),
            'title' => $nodeTranslation->getTitle(),
            'slug' => $nodeTranslation->getFullSlug(),
            'page_class' => ClassLookup::getClass($page),
            'created' => $this->getUTCDateTime(
                $nodeTranslation->getCreated()
            )->format(\DateTime::ISO8601),
            'updated' => $this->getUTCDateTime(
                $nodeTranslation->getUpdated()
            )->format(\DateTime::ISO8601),
        );
        if ($this->logger) {
            $this->logger->info('Indexing document : ' . implode(', ', $doc));
        }

        // Permissions
        $this->addPermissions($node, $doc);

        // Search type
        $this->addSearchType($page, $doc);

        // Parent and Ancestors
        $this->addParentAndAncestors($node, $doc);

        // Content
        $this->addPageContent($nodeTranslation, $page, $doc);

        // Add document to index
        $uid = 'nodetranslation_' . $nodeTranslation->getId();

        $this->addCustomData($page, $doc);

        $this->documents[] = $this->searchProvider->createDocument(
            $uid,
            $doc,
            $this->indexName . '_' . $nodeTranslation->getLang(),
            $this->indexType
        );
    }
protected function addPageToIndex ( NodeTranslation $ nodeTranslation , Node $ node , NodeVersion $ publicNodeVersion , HasNodeInterface $ page ) { $ rootNode = $ this -> currentTopNode ; if ( ! $ rootNode ) { // Fetch main parent of current node... $ rootNode = $ this -> em -> getRepository ( 'KunstmaanNodeBundle:Node' ) -> getRootNodeFor ( $ node , $ nodeTranslation -> getLang ( ) ) ; } $ doc = array ( 'root_id' => $ rootNode -> getId ( ) , 'node_id' => $ node -> getId ( ) , 'node_translation_id' => $ nodeTranslation -> getId ( ) , 'node_version_id' => $ publicNodeVersion -> getId ( ) , 'title' => $ nodeTranslation -> getTitle ( ) , 'slug' => $ nodeTranslation -> getFullSlug ( ) , 'page_class' => ClassLookup :: getClass ( $ page ) , 'created' => $ this -> getUTCDateTime ( $ nodeTranslation -> getCreated ( ) ) -> format ( \ DateTime :: ISO8601 ) , 'updated' => $ this -> getUTCDateTime ( $ nodeTranslation -> getUpdated ( ) ) -> format ( \ DateTime :: ISO8601 ) , ) ; if ( $ this -> logger ) { $ this -> logger -> info ( 'Indexing document : ' . implode ( ', ' , $ doc ) ) ; } // Permissions $ this -> addPermissions ( $ node , $ doc ) ; // Search type $ this -> addSearchType ( $ page , $ doc ) ; // Parent and Ancestors $ this -> addParentAndAncestors ( $ node , $ doc ) ; // Content $ this -> addPageContent ( $ nodeTranslation , $ page , $ doc ) ; // Add document to index $ uid = 'nodetranslation_' . $ nodeTranslation -> getId ( ) ; $ this -> addCustomData ( $ page , $ doc ) ; $ this -> documents [ ] = $ this -> searchProvider -> createDocument ( $ uid , $ doc , $ this -> indexName . '_' . $ nodeTranslation -> getLang ( ) , $ this -> indexType ) ; }
Create a search document for a page

@param NodeTranslation  $nodeTranslation
@param Node             $node
@param NodeVersion      $publicNodeVersion
@param HasNodeInterface $page
Create a search document for a page