protected function cleanUpIndex()
    {
        $cleanUpResult = true;
        $solrConfiguration = $this->getSite()->getSolrConfiguration();
        $solrServers = GeneralUtility::makeInstance(ConnectionManager::class)->getConnectionsBySite($this->getSite());
        $typesToCleanUp = [];
        $enableCommitsSetting = $solrConfiguration->getEnableCommits();

        foreach ($this->indexingConfigurationsToReIndex as $indexingConfigurationName) {
            $type = $solrConfiguration->getIndexQueueTableNameOrFallbackToConfigurationName($indexingConfigurationName);
            $typesToCleanUp[] = $type;
        }

        foreach ($solrServers as $solrServer) {
            $deleteQuery = 'type:(' . implode(' OR ', $typesToCleanUp) . ')' . ' AND siteHash:' . $this->getSite()->getSiteHash();
            $solrServer->getWriteService()->deleteByQuery($deleteQuery);

            if (!$enableCommitsSetting) {
                # Do not commit
                continue;
            }

            $response = $solrServer->getWriteService()->commit(false, false, false);
            if ($response->getHttpStatus() != 200) {
                $cleanUpResult = false;
                break;
            }
        }

        return $cleanUpResult;
    }
protected function cleanUpIndex()
    {
        $cleanUpResult = true;
        $solrConfiguration = $this->getSite()->getSolrConfiguration();
        $solrServers = GeneralUtility::makeInstance(ConnectionManager::class)->getConnectionsBySite($this->getSite());
        $typesToCleanUp = [];
        $enableCommitsSetting = $solrConfiguration->getEnableCommits();

        foreach ($this->indexingConfigurationsToReIndex as $indexingConfigurationName) {
            $type = $solrConfiguration->getIndexQueueTableNameOrFallbackToConfigurationName($indexingConfigurationName);
            $typesToCleanUp[] = $type;
        }

        foreach ($solrServers as $solrServer) {
            $deleteQuery = 'type:(' . implode(' OR ', $typesToCleanUp) . ')' . ' AND siteHash:' . $this->getSite()->getSiteHash();
            $solrServer->getWriteService()->deleteByQuery($deleteQuery);

            if (!$enableCommitsSetting) {
                # Do not commit
                continue;
            }

            $response = $solrServer->getWriteService()->commit(false, false, false);
            if ($response->getHttpStatus() != 200) {
                $cleanUpResult = false;
                break;
            }
        }

        return $cleanUpResult;
    }
protected function cleanUpIndex ( ) { $ cleanUpResult = true ; $ solrConfiguration = $ this -> getSite ( ) -> getSolrConfiguration ( ) ; $ solrServers = GeneralUtility :: makeInstance ( ConnectionManager :: class ) -> getConnectionsBySite ( $ this -> getSite ( ) ) ; $ typesToCleanUp = [ ] ; $ enableCommitsSetting = $ solrConfiguration -> getEnableCommits ( ) ; foreach ( $ this -> indexingConfigurationsToReIndex as $ indexingConfigurationName ) { $ type = $ solrConfiguration -> getIndexQueueTableNameOrFallbackToConfigurationName ( $ indexingConfigurationName ) ; $ typesToCleanUp [ ] = $ type ; } foreach ( $ solrServers as $ solrServer ) { $ deleteQuery = 'type:(' . implode ( ' OR ' , $ typesToCleanUp ) . ')' . ' AND siteHash:' . $ this -> getSite ( ) -> getSiteHash ( ) ; $ solrServer -> getWriteService ( ) -> deleteByQuery ( $ deleteQuery ) ; if ( ! $ enableCommitsSetting ) { # Do not commit continue ; } $ response = $ solrServer -> getWriteService ( ) -> commit ( false , false , false ) ; if ( $ response -> getHttpStatus ( ) != 200 ) { $ cleanUpResult = false ; break ; } } return $ cleanUpResult ; }
Removes documents of the selected types from the index.

@return bool TRUE if clean up was successful, FALSE on error
Removes documents of the selected types from the index .