/** * @param bool $useCache * @return bool */ public function getIsSolrAvailable($useCache = true) { if (!$useCache) { return $this->search->ping(); } if ($this->isSolrAvailable === true) { return true; } $this->isSolrAvailable = $this->search->ping(); return $this->isSolrAvailable; }
/** * Initializes the Solr connection and tests the connection through a ping. * */ protected function initializeSearch() { $solrConnection = GeneralUtility::makeInstance('ApacheSolrForTypo3\\Solr\\ConnectionManager')->getConnectionByPageId($GLOBALS['TSFE']->id, $GLOBALS['TSFE']->sys_language_uid, $GLOBALS['TSFE']->MP); $this->search = GeneralUtility::makeInstance('ApacheSolrForTypo3\\Solr\\Search', $solrConnection); $this->solrAvailable = $this->search->ping(); }