Purges/commits all Solr indexes, initializes the Index Queue
and returns TRUE if the execution was successful

@return bool Returns TRUE on success, FALSE on failure.
181644
public function execute()
    {
        // clean up
        $cleanUpResult = $this->cleanUpIndex();

        // initialize for re-indexing
            /** @var Queue $indexQueue */
        $indexQueue = GeneralUtility::makeInstance(Queue::class);
        $indexQueueInitializationResults = $indexQueue->getInitializationService()
            ->initializeBySiteAndIndexConfigurations($this->getSite(), $this->indexingConfigurationsToReIndex);

        return ($cleanUpResult && !in_array(false, $indexQueueInitializationResults));
    }
1307309
protected function flushQueue() : bool
    {
        foreach (array_keys($this->jobQueues) as $jobName) {
            $this->jobQueues[$jobName] = [];
        }
        $this->jobsInQueue = 0;
        return true;
    }
204723
public function purgeExpired()
    {

        if ($this->sqlInitialized()) {
            if ($this->sql) {
                if ($this->sql->query("
                    DELETE
                        FROM `{$this->table}`
                        WHERE `expire` < NOW()
                ")) {
                    return true;
                }
            }
        }
        return false;
    }
1275233
public function resetLogErrorsAction()
    {
        $resetResult = $this->indexQueue->resetAllErrors();

        $label = 'solr.backend.index_queue_module.flashmessage.success.reset_errors';
        $severity = FlashMessage::OK;
        if (!$resetResult) {
            $label = 'solr.backend.index_queue_module.flashmessage.error.reset_errors';
            $severity = FlashMessage::ERROR;
        }

        $this->addIndexQueueFlashMessage($label, $severity);

        $this->redirect('index');
    }
1337046
public function flush() {
		$pattern = $this->getCachePath() . DIRECTORY_SEPARATOR . $this->prefix . '_*';
		
		if (self::isExecAvailable()) {
			exec('rm ' . $pattern);
			return true;
		}
		
		$list = glob($pattern);
		
		if ($list === false) {
			return false;
		}
		
		if (empty($list)) {
			return true;
		}
		
		$result = true;
		
		foreach ($list as $path) {
			if (! unlink($path)) {
				$result = false;
			}
		}
		
		return $result;
	}
379415
public function destroyAll()
	{
		// @FIXME: could make this a single query...
		if ($this->count())
		{
			foreach ($this->rows as $model)
			{
				if (!$model->destroy())
				{
					$this->setErrors($model->getErrors());
					return false;
				}
			}
		}

		return true;
	}
121840
public function purge()
    {
        if ($this->purger === null) {
            throw new \Exception('Doctrine\Common\DataFixtures\Purger\PurgerInterface instance is required if you want to purge the database before loading your data fixtures.');
        }
        if ($this->logger) {
            $this->log('purging database');
        }
        $this->purger->purge();
    }
1163580
public function commit(): bool {
        if ($this->transactionExists) {
            $commited = $this->pdo->commit();
            $this->transactionExists = !$commited;
            return $commited;
        }
        return false;
    }
1306106
public function clearIndex()
    {
        $this->eventManager->dispatch(Events::PRE_CLEAR_INDEX, new Event($this->solrClientCore));

        try {
            $client = new SolariumMulticoreClient($this->solrClientCore);
            $client->clearCores();
        } catch (\Exception $e) {
            $errorEvent = new ErrorEvent(null, null, 'clear-index');
            $errorEvent->setException($e);

            $this->eventManager->dispatch(Events::ERROR, $errorEvent);

            throw new SolrException($e->getMessage(), $e->getCode(), $e);
        }

        $this->eventManager->dispatch(Events::POST_CLEAR_INDEX, new Event($this->solrClientCore));
    }
604233
public function createIndex(): bool
    {
        $class = $this->class;

        $indexParams = [
            'index' => $this->index,
        ];

        if (count($this->notAnalyzedFields)) {
            $indexParams['body'] = [
                'mappings' => [
                    $class => [
                        '_source'    => [
                            'enabled' => true
                        ],
                        'properties' => $this->createNotAnalyzedFieldsMapping($this->notAnalyzedFields),
                    ]
                ]
            ];
        }

        $this->client->indices()->create($indexParams);
        $response = $this->client->cluster()->health([
            'index'           => $this->index,
            'wait_for_status' => 'yellow',
            'timeout'         => '5s',
        ]);

        return isset($response['status']) && $response['status'] !== 'red';
    }
1225341
public function commit() {
		if ($this->txStatus == self::TX_STARTED && $this->txCounter == 1) {
			$this->txStatus = self::TX_NOT_STARTED;
			$this->txCounter = 0;
			return $this->driver->commit();
		}
		
		$this->txCounter--;
		return false;
	}
571920
public function commit(): bool
    {
        foreach ($this->deferred as $key => $item) {
            $result = $this->save($item);
            unset($this->deferred[$key]);

            if (false === $result) {
                return false;
            }
        }
        return true;
    }
1071607
public function process()
    {
        // Skip blank queues
        if (empty($this->batches)) {
            return true;
        }

        // Don't re-process completed queue
        if ($this->currentBatch >= count($this->batches)) {
            return true;
        }

        // Send current patch to indexes
        $this->prepareIndexes();

        // Advance to next batch if successful
        $this->setBatch($this->currentBatch + 1);
        return true;
    }
799384
public function flush()
    {
        try {
        	$this->helper->recursivelyDeleteFromDirectory($this->path);
        	return true;

        // @codeCoverageIgnoreStart
        } catch (\Exception $e) {
        }

        return false;
        // @codeCoverageIgnoreEnd
    }
127863
public function commit()
    {
        switch ($this->mode) {

            case "mysql":
                $result = $this->server->commit();
                break;

            case "postgres":
            case "redshift":
                $result = $this->query("COMMIT");
                break;

            case "odbc":
                $result = odbc_commit($this->server);
                break;

            default:
                throw new \Exception("commit() not supported in this mode (" . $this->mode . ")");
        }

        if (!$result) {
            $this->error();
        }

        return true;
    }
827798
private function hasSearchIndex()
    {
        $metadata = $this->repository->getClassMetadata();
        $indexes = $metadata->getIndexes();
        if (empty($indexes)) {
            return false;
        }

        $text = array_filter(
            $indexes,
            function ($index) {
                if (isset($index['keys'])) {
                    $hasText = false;
                    foreach ($index['keys'] as $name => $direction) {
                        if ($direction == 'text') {
                            $hasText = true;
                        }
                    }
                    return $hasText;
                }
            }
        );

        return !empty($text);
    }
986115
protected function commitIndex($index)
    {
        // Skip index if this is already complete
        $name = get_class($index);
        if (in_array($name, $this->completed)) {
            $this->addMessage("Skipping already comitted index {$name}");
            return;
        }

        // Bypass SolrIndex::commit exception handling so that queuedjobs can handle the error
        $this->addMessage("Committing index {$name}");
        $index->getService()->commit(false, false, false);
        $this->addMessage("Committing index {$name} was successful");

        // If this index is currently marked as dirty, it's now clean
        if (in_array($name, static::$dirty_indexes)) {
            static::$dirty_indexes = array_diff(static::$dirty_indexes, array($name));
        }

        // Mark complete
        $this->completed[] = $name;
    }