示例#1
0
 /**
  * @param string $table
  * @param int $uid
  * @return \Apache_Solr_Response
  */
 protected function addToQueueAndIndexRecord($table, $uid)
 {
     // write an index queue item
     $this->indexQueue->updateItem($table, $uid);
     // run the indexer
     $items = $this->indexQueue->getItems($table, $uid);
     foreach ($items as $item) {
         $result = $this->indexer->index($item);
     }
     return $result;
 }
示例#2
0
 /**
  * Gets the Solr connections applicaple for a page.
  *
  * The connections include the default connection and connections to be used
  * for translations of a page.
  *
  * @param Item $item An index queue item
  * @return array An array of ApacheSolrForTypo3\Solr\SolrService connections, the array's keys are the sys_language_uid of the language of the connection
  */
 protected function getSolrConnectionsByItem(Item $item)
 {
     $solrConnections = parent::getSolrConnectionsByItem($item);
     $page = $item->getRecord();
     // may use \TYPO3\CMS\Core\Utility\GeneralUtility::hideIfDefaultLanguage($page['l18n_cfg']) with TYPO3 4.6
     if ($page['l18n_cfg'] & 1) {
         // page is configured to hide the default translation -> remove Solr connection for default language
         unset($solrConnections[0]);
     }
     if (GeneralUtility::hideIfNotTranslated($page['l18n_cfg'])) {
         $accessibleSolrConnections = array();
         if (isset($solrConnections[0])) {
             $accessibleSolrConnections[0] = $solrConnections[0];
         }
         $translationOverlays = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('pid, sys_language_uid', 'pages_language_overlay', 'pid = ' . $page['uid'] . BackendUtility::deleteClause('pages_language_overlay') . BackendUtility::BEenableFields('pages_language_overlay'));
         foreach ($translationOverlays as $overlay) {
             $languageId = $overlay['sys_language_uid'];
             $accessibleSolrConnections[$languageId] = $solrConnections[$languageId];
         }
         $solrConnections = $accessibleSolrConnections;
     }
     return $solrConnections;
 }