Beispiel #1
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;
 }
 /**
  * Retrieves a record, taking into account the additionalWhereClauses of the
  * Indexing Queue configurations.
  *
  * @param string $recordTable Table to read from
  * @param int $recordUid Id of the record
  * @return array Record if found, otherwise empty array
  */
 protected function getRecord($recordTable, $recordUid)
 {
     $record = array();
     $indexingConfigurations = $this->indexQueue->getTableIndexingConfigurations($this->solrConfiguration);
     foreach ($indexingConfigurations as $indexingConfigurationName) {
         $tableToIndex = $indexingConfigurationName;
         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 = t3lib_BEfunc::getRecord($recordTable, $recordUid, '*', $recordWhereClause);
             if (!empty($record)) {
                 // if we found a record which matches the conditions, we can continue
                 break;
             }
         }
     }
     return $record;
 }