bin/php/updatesearchindexsolr.php
protected function execute( $nodeID, $offset, $limit )
    {
        $count = 0;
        $node = eZContentObjectTreeNode::fetch( $nodeID );
        if ( !( $node instanceof eZContentObjectTreeNode ) )
        {
            $this->CLI->error( "An error occured while trying fetching node $nodeID" );
            return 0;
        }
        $searchEngine = new eZSolr();

        if (
            $subTree = $node->subTree(
                array(
                    'Offset' => $offset,
                    'Limit' => $limit,
                    'SortBy' => array(),
                    'Limitation' => array(),
                    'MainNodeOnly' => true
                )
            )
        )
        {
            foreach ( $subTree as $innerNode )
            {
                $object = $innerNode->attribute( 'object' );
                if ( !$object )
                {
                    continue;
                }

                //pass false as we are going to do a commit at the end
                $result = $searchEngine->addObject( $object, false, $this->commitWithin * 1000 );
                if ( !$result )
                {
                    $this->CLI->error( ' Failed indexing ' . $object->attribute('class_identifier') .  ' object with ID ' . $object->attribute( 'id' ) );
                }
                ++$count;
            }
        }

        return $count;
    }
protected function execute( $nodeID, $offset, $limit )
    {
        $count = 0;
        $node = eZContentObjectTreeNode::fetch( $nodeID );
        if ( !( $node instanceof eZContentObjectTreeNode ) )
        {
            $this->CLI->error( "An error occured while trying fetching node $nodeID" );
            return 0;
        }
        $searchEngine = new eZSolr();

        if (
            $subTree = $node->subTree(
                array(
                    'Offset' => $offset,
                    'Limit' => $limit,
                    'SortBy' => array(),
                    'Limitation' => array(),
                    'MainNodeOnly' => true
                )
            )
        )
        {
            foreach ( $subTree as $innerNode )
            {
                $object = $innerNode->attribute( 'object' );
                if ( !$object )
                {
                    continue;
                }

                //pass false as we are going to do a commit at the end
                $result = $searchEngine->addObject( $object, false, $this->commitWithin * 1000 );
                if ( !$result )
                {
                    $this->CLI->error( ' Failed indexing ' . $object->attribute('class_identifier') .  ' object with ID ' . $object->attribute( 'id' ) );
                }
                ++$count;
            }
        }

        return $count;
    }
protected function execute ( $ nodeID , $ offset , $ limit ) { $ count = 0 ; $ node = eZContentObjectTreeNode :: fetch ( $ nodeID ) ; if ( ! ( $ node instanceof eZContentObjectTreeNode ) ) { $ this -> CLI -> error ( "An error occured while trying fetching node $nodeID" ) ; return 0 ; } $ searchEngine = new eZSolr ( ) ; if ( $ subTree = $ node -> subTree ( array ( 'Offset' => $ offset , 'Limit' => $ limit , 'SortBy' => array ( ) , 'Limitation' => array ( ) , 'MainNodeOnly' => true ) ) ) { foreach ( $ subTree as $ innerNode ) { $ object = $ innerNode -> attribute ( 'object' ) ; if ( ! $ object ) { continue ; } //pass false as we are going to do a commit at the end $ result = $ searchEngine -> addObject ( $ object , false , $ this -> commitWithin * 1000 ) ; if ( ! $ result ) { $ this -> CLI -> error ( ' Failed indexing ' . $ object -> attribute ( 'class_identifier' ) . ' object with ID ' . $ object -> attribute ( 'id' ) ) ; } ++ $ count ; } } return $ count ; }
Execute indexing of subtree

@param int $nodeID
@param int $offset
@param int $limit

@return int Number of objects indexed.
Execute indexing of subtree