Exemple #1
0
 /**
  * Sends a ping to the solr server to see whether it is available.
  *
  * @return boolean Returns TRUE on successful ping.
  * @throws \Exception Throws an exception in case ping was not successful.
  */
 public function ping()
 {
     $solrAvailable = FALSE;
     try {
         if (!$this->solr->ping()) {
             throw new \Exception('Solr Server not responding.', 1237475791);
         }
         $solrAvailable = TRUE;
     } catch (\Exception $e) {
         if ($GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_solr.']['logging.']['exceptions']) {
             GeneralUtility::devLog('exception while trying to ping the solr server', 'solr', 3, array($e->__toString()));
         }
     }
     return $solrAvailable;
 }
Exemple #2
0
 /**
  * Sends a ping to the solr server to see whether it is available.
  *
  * @return boolean Returns TRUE on successful ping.
  * @throws \Exception Throws an exception in case ping was not successful.
  */
 public function ping()
 {
     $solrAvailable = false;
     try {
         if (!$this->solr->ping()) {
             throw new \Exception('Solr Server not responding.', 1237475791);
         }
         $solrAvailable = true;
     } catch (\Exception $e) {
         if ($this->configuration->getLoggingExceptions()) {
             GeneralUtility::devLog('exception while trying to ping the solr server', 'solr', 3, array($e->__toString()));
         }
     }
     return $solrAvailable;
 }
 /**
  * Allows to provide a Solr server connection other than the one
  * initialized by the constructor.
  *
  * @param SolrService $solrConnection Solr connection
  * @throws \Exception if the Solr server cannot be reached
  */
 public function setSolrConnection(SolrService $solrConnection)
 {
     if (!$solrConnection->ping()) {
         throw new \Exception('Could not connect to Solr server.', 1323946472);
     }
     $this->solrConnection = $solrConnection;
 }