src/Kunstmaan/NodeSearchBundle/Configuration/NodePagesConfiguration.php
public function indexNodeTranslation(NodeTranslation $nodeTranslation, $add = false)
    {
        // Retrieve the public NodeVersion
        $publicNodeVersion = $nodeTranslation->getPublicNodeVersion();
        if (is_null($publicNodeVersion)) {
            return false;
        }

        $refPage = $this->getNodeRefPage($publicNodeVersion);
        if ($refPage->isStructureNode()) {
            return true;
        }

        // Only index online NodeTranslations
        if (!$nodeTranslation->isOnline()) {
            return false;
        }

        $node = $nodeTranslation->getNode();
        if ($this->isIndexable($refPage)) {
            // Retrieve the referenced entity from the public NodeVersion
            $page = $publicNodeVersion->getRef($this->em);

            $this->addPageToIndex($nodeTranslation, $node, $publicNodeVersion, $page);
            if ($add) {
                $this->searchProvider->addDocuments($this->documents);
                $this->documents = [];
            }
        }

        return true; // return true even if the page itself should not be indexed. This makes sure its children are being processed (i.e. structured nodes)
    }
public function indexNodeTranslation(NodeTranslation $nodeTranslation, $add = false)
    {
        // Retrieve the public NodeVersion
        $publicNodeVersion = $nodeTranslation->getPublicNodeVersion();
        if (is_null($publicNodeVersion)) {
            return false;
        }

        $refPage = $this->getNodeRefPage($publicNodeVersion);
        if ($refPage->isStructureNode()) {
            return true;
        }

        // Only index online NodeTranslations
        if (!$nodeTranslation->isOnline()) {
            return false;
        }

        $node = $nodeTranslation->getNode();
        if ($this->isIndexable($refPage)) {
            // Retrieve the referenced entity from the public NodeVersion
            $page = $publicNodeVersion->getRef($this->em);

            $this->addPageToIndex($nodeTranslation, $node, $publicNodeVersion, $page);
            if ($add) {
                $this->searchProvider->addDocuments($this->documents);
                $this->documents = [];
            }
        }

        return true; // return true even if the page itself should not be indexed. This makes sure its children are being processed (i.e. structured nodes)
    }
public function indexNodeTranslation ( NodeTranslation $ nodeTranslation , $ add = false ) { // Retrieve the public NodeVersion $ publicNodeVersion = $ nodeTranslation -> getPublicNodeVersion ( ) ; if ( is_null ( $ publicNodeVersion ) ) { return false ; } $ refPage = $ this -> getNodeRefPage ( $ publicNodeVersion ) ; if ( $ refPage -> isStructureNode ( ) ) { return true ; } // Only index online NodeTranslations if ( ! $ nodeTranslation -> isOnline ( ) ) { return false ; } $ node = $ nodeTranslation -> getNode ( ) ; if ( $ this -> isIndexable ( $ refPage ) ) { // Retrieve the referenced entity from the public NodeVersion $ page = $ publicNodeVersion -> getRef ( $ this -> em ) ; $ this -> addPageToIndex ( $ nodeTranslation , $ node , $ publicNodeVersion , $ page ) ; if ( $ add ) { $ this -> searchProvider -> addDocuments ( $ this -> documents ) ; $ this -> documents = [ ] ; } } return true ; // return true even if the page itself should not be indexed. This makes sure its children are being processed (i.e. structured nodes) }
Index a node translation

@param NodeTranslation $nodeTranslation
@param bool            $add             Add node immediately to index?

@return bool Return true if the document has been indexed
Index a node translation