/**
  * Triggers Index Queue updates for other pages showing content from the
  * page currently being updated.
  *
  * @param integer $pageId UID of the page currently being updated
  */
 protected function updateCanonicalPages($pageId)
 {
     $canonicalPages = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('uid', 'pages', 'content_from_pid = ' . $pageId . t3lib_BEfunc::deleteClause('pages'));
     foreach ($canonicalPages as $page) {
         $this->indexQueue->updateItem('pages', $page['uid']);
     }
 }
Esempio n. 2
0
 /**
  * Retrieves the name of the  Indexing Queue Configuration for a record
  *
  * @param string $recordTable Table to read from
  * @param int $recordUid Id of the record
  * @return string Name of indexing configuration
  */
 protected function getIndexingConfigurationName($recordTable, $recordUid)
 {
     $name = $recordTable;
     $indexingConfigurations = $this->indexQueue->getTableIndexingConfigurations($this->solrConfiguration);
     foreach ($indexingConfigurations as $indexingConfigurationName) {
         $tableToIndex = $indexingConfigurationName;
         if (!$this->solrConfiguration['index.']['queue.'][$indexingConfigurationName]) {
             // ignore disabled indexing configurations
             continue;
         }
         if (!empty($this->solrConfiguration['index.']['queue.'][$indexingConfigurationName . '.']['table'])) {
             // table has been set explicitly. Allows to index the same table with different configurations
             $tableToIndex = $this->solrConfiguration['index.']['queue.'][$indexingConfigurationName . '.']['table'];
         }
         if ($tableToIndex === $recordTable) {
             $recordWhereClause = $this->buildUserWhereClause($indexingConfigurationName);
             $record = BackendUtility::getRecord($recordTable, $recordUid, '*', $recordWhereClause);
             if (!empty($record)) {
                 // we found a record which matches the conditions
                 $name = $indexingConfigurationName;
                 // FIXME currently returns after the first configuration match
                 break;
             }
         }
     }
     return $name;
 }
Esempio n. 3
0
 /**
  * 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 = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('Tx_Solr_ConnectionManager')->getConnectionsBySite($this->site);
     $typesToCleanUp = array();
     foreach ($this->indexingConfigurationsToReIndex as $indexingConfigurationName) {
         $type = Tx_Solr_IndexQueue_Queue::getTableToIndexByIndexingConfigurationName($solrConfiguration, $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;
 }