/** * Removes documents of the selected types from the index. * * @return bool TRUE if clean up was successful, FALSE on error */ protected function cleanUpIndex() { $cleanUpResult = true; $solrConfiguration = $this->site->getSolrConfiguration(); $solrServers = GeneralUtility::makeInstance('ApacheSolrForTypo3\\Solr\\ConnectionManager')->getConnectionsBySite($this->site); $typesToCleanUp = array(); foreach ($this->indexingConfigurationsToReIndex as $indexingConfigurationName) { $type = $solrConfiguration->getIndexQueueTableNameOrFallbackToConfigurationName($indexingConfigurationName); $typesToCleanUp[] = $type; } foreach ($solrServers as $solrServer) { // make sure not-yet committed documents are removed, too $solrServer->commit(); $deleteQuery = 'type:(' . implode(' OR ', $typesToCleanUp) . ')' . ' AND siteHash:' . $this->site->getSiteHash(); $solrServer->deleteByQuery($deleteQuery); $response = $solrServer->commit(false, false, false); if ($response->getHttpStatus() != 200) { $cleanUpResult = false; break; } } return $cleanUpResult; }