public function SolrConnectorPluginBase::getSolrVersion in Search API Solr 8.2
Same name and namespace in other branches
- 8.3 src/SolrConnector/SolrConnectorPluginBase.php \Drupal\search_api_solr\SolrConnector\SolrConnectorPluginBase::getSolrVersion()
- 8 src/SolrConnector/SolrConnectorPluginBase.php \Drupal\search_api_solr\SolrConnector\SolrConnectorPluginBase::getSolrVersion()
- 4.x src/SolrConnector/SolrConnectorPluginBase.php \Drupal\search_api_solr\SolrConnector\SolrConnectorPluginBase::getSolrVersion()
Gets the current Solr version.
Parameters
bool $force_auto_detect: If TRUE, ignore user overwrites.
Return value
string The full Solr version string.
Overrides SolrConnectorInterface::getSolrVersion
4 calls to SolrConnectorPluginBase::getSolrVersion()
- SolrConnectorPluginBase::getLuceneMatchVersion in src/
SolrConnector/ SolrConnectorPluginBase.php - Gets the LuceneMatchVersion string.
- SolrConnectorPluginBase::getSolrMajorVersion in src/
SolrConnector/ SolrConnectorPluginBase.php - Gets the current Solr major version.
- SolrConnectorPluginBase::getStatsSummary in src/
SolrConnector/ SolrConnectorPluginBase.php - Gets summary information about the Solr Core.
- StandardSolrCloudConnector::getStatsSummary in src/
Plugin/ SolrConnector/ StandardSolrCloudConnector.php - Gets summary information about the Solr Core.
File
- src/
SolrConnector/ SolrConnectorPluginBase.php, line 360
Class
- SolrConnectorPluginBase
- Defines a base class for Solr connector plugins.
Namespace
Drupal\search_api_solr\SolrConnectorCode
public function getSolrVersion($force_auto_detect = FALSE) {
// Allow for overrides by the user.
if (!$force_auto_detect && !empty($this->configuration['solr_version'])) {
// In most cases the already stored solr_version is just the major version
// number as integer. In this case we will expand it to the minimum
// corresponding full version string.
$min_version = [
'0',
'0',
'0',
];
$version = explode('.', $this->configuration['solr_version']) + $min_version;
return implode('.', $version);
}
$info = [];
try {
$info = $this
->getCoreInfo();
} catch (SearchApiSolrException $e) {
try {
$info = $this
->getServerInfo();
} catch (SearchApiSolrException $e) {
}
}
// Get our solr version number.
if (isset($info['lucene']['solr-spec-version'])) {
return $info['lucene']['solr-spec-version'];
}
return '0.0.0';
}