コード例 #1
0
ファイル: Indexer.php プロジェクト: punktDe/solr
 /**
  * Enables logging dependent on the configuration of the item's site
  *
  * @param	Tx_Solr_IndexQueue_Item	$item An item being indexed
  * @return	void
  */
 protected function setLogging(Tx_Solr_IndexQueue_Item $item)
 {
     // reset
     $this->loggingEnabled = FALSE;
     $solrConfiguration = Tx_Solr_Util::getSolrConfigurationFromPageId($item->getRootPageUid());
     if (!empty($solrConfiguration['logging.']['indexing']) || !empty($solrConfiguration['logging.']['indexing.']['queue']) || !empty($solrConfiguration['logging.']['indexing.']['queue.'][$item->getIndexingConfigurationName()])) {
         $this->loggingEnabled = TRUE;
     }
 }
コード例 #2
0
 /**
  * Indexes an item from the Index Queue.
  *
  * @param Tx_Solr_IndexQueue_Item $item An index queue item to index
  * @return boolean TRUE if the item was successfully indexed, FALSE otherwise
  */
 protected function indexItem(Tx_Solr_IndexQueue_Item $item)
 {
     $itemIndexed = FALSE;
     $indexer = $this->getIndexerByItem($item->getIndexingConfigurationName());
     // Remember original http host value
     $originalHttpHost = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : NULL;
     // Overwrite http host
     $this->initializeHttpHost($item);
     $itemIndexed = $indexer->index($item);
     // update IQ item so that the IQ can determine what's been indexed already
     if ($itemIndexed) {
         $item->updateIndexedTime();
     }
     // restore http host
     if (!is_null($originalHttpHost)) {
         $_SERVER['HTTP_HOST'] = $originalHttpHost;
     } else {
         unset($_SERVER['HTTP_HOST']);
     }
     return $itemIndexed;
 }