public function indexItems($limit)
    {
        $errors     = 0;
        $indexRunId = uniqid();
        $configurationToUse = $this->site->getSolrConfiguration();
        $enableCommitsSetting = $configurationToUse->getEnableCommits();

        // get items to index
        $itemsToIndex = $this->indexQueue->getItemsToIndex($this->site, $limit);

        $this->emitSignal('beforeIndexItems', [$itemsToIndex, $this->getContextTask(), $indexRunId]);

        foreach ($itemsToIndex as $itemToIndex) {
            try {
                // try indexing
                $this->emitSignal('beforeIndexItem', [$itemToIndex, $this->getContextTask(), $indexRunId]);
                $this->indexItem($itemToIndex, $configurationToUse);
                $this->emitSignal('afterIndexItem', [$itemToIndex, $this->getContextTask(), $indexRunId]);
            } catch (\Exception $e) {
                $errors++;
                $this->indexQueue->markItemAsFailed($itemToIndex, $e->getCode() . ': ' . $e->__toString());
                $this->generateIndexingErrorLog($itemToIndex, $e);
            }
        }

        $this->emitSignal('afterIndexItems', [$itemsToIndex, $this->getContextTask(), $indexRunId]);

        if ($enableCommitsSetting && count($itemsToIndex) > 0) {
            $solrServers = GeneralUtility::makeInstance(ConnectionManager::class)->getConnectionsBySite($this->site);
            foreach ($solrServers as $solrServer) {
                try {
                    $solrServer->getWriteService()->commit(false, false, false);
                } catch (HttpException $e) {
                    $errors++;
                }
            }
        }

        return ($errors === 0);
    }
public function indexItems($limit)
    {
        $errors     = 0;
        $indexRunId = uniqid();
        $configurationToUse = $this->site->getSolrConfiguration();
        $enableCommitsSetting = $configurationToUse->getEnableCommits();

        // get items to index
        $itemsToIndex = $this->indexQueue->getItemsToIndex($this->site, $limit);

        $this->emitSignal('beforeIndexItems', [$itemsToIndex, $this->getContextTask(), $indexRunId]);

        foreach ($itemsToIndex as $itemToIndex) {
            try {
                // try indexing
                $this->emitSignal('beforeIndexItem', [$itemToIndex, $this->getContextTask(), $indexRunId]);
                $this->indexItem($itemToIndex, $configurationToUse);
                $this->emitSignal('afterIndexItem', [$itemToIndex, $this->getContextTask(), $indexRunId]);
            } catch (\Exception $e) {
                $errors++;
                $this->indexQueue->markItemAsFailed($itemToIndex, $e->getCode() . ': ' . $e->__toString());
                $this->generateIndexingErrorLog($itemToIndex, $e);
            }
        }

        $this->emitSignal('afterIndexItems', [$itemsToIndex, $this->getContextTask(), $indexRunId]);

        if ($enableCommitsSetting && count($itemsToIndex) > 0) {
            $solrServers = GeneralUtility::makeInstance(ConnectionManager::class)->getConnectionsBySite($this->site);
            foreach ($solrServers as $solrServer) {
                try {
                    $solrServer->getWriteService()->commit(false, false, false);
                } catch (HttpException $e) {
                    $errors++;
                }
            }
        }

        return ($errors === 0);
    }
public function indexItems ( $ limit ) { $ errors = 0 ; $ indexRunId = uniqid ( ) ; $ configurationToUse = $ this -> site -> getSolrConfiguration ( ) ; $ enableCommitsSetting = $ configurationToUse -> getEnableCommits ( ) ; // get items to index $ itemsToIndex = $ this -> indexQueue -> getItemsToIndex ( $ this -> site , $ limit ) ; $ this -> emitSignal ( 'beforeIndexItems' , [ $ itemsToIndex , $ this -> getContextTask ( ) , $ indexRunId ] ) ; foreach ( $ itemsToIndex as $ itemToIndex ) { try { // try indexing $ this -> emitSignal ( 'beforeIndexItem' , [ $ itemToIndex , $ this -> getContextTask ( ) , $ indexRunId ] ) ; $ this -> indexItem ( $ itemToIndex , $ configurationToUse ) ; $ this -> emitSignal ( 'afterIndexItem' , [ $ itemToIndex , $ this -> getContextTask ( ) , $ indexRunId ] ) ; } catch ( \ Exception $ e ) { $ errors ++ ; $ this -> indexQueue -> markItemAsFailed ( $ itemToIndex , $ e -> getCode ( ) . ': ' . $ e -> __toString ( ) ) ; $ this -> generateIndexingErrorLog ( $ itemToIndex , $ e ) ; } } $ this -> emitSignal ( 'afterIndexItems' , [ $ itemsToIndex , $ this -> getContextTask ( ) , $ indexRunId ] ) ; if ( $ enableCommitsSetting && count ( $ itemsToIndex ) > 0 ) { $ solrServers = GeneralUtility :: makeInstance ( ConnectionManager :: class ) -> getConnectionsBySite ( $ this -> site ) ; foreach ( $ solrServers as $ solrServer ) { try { $ solrServer -> getWriteService ( ) -> commit ( false , false , false ) ; } catch ( HttpException $ e ) { $ errors ++ ; } } } return ( $ errors === 0 ) ; }
Indexes items from the Index Queue.

@param int $limit
@return bool
Indexes items from the Index Queue .