You are here

function apachesolr_realtime_solrversion in Apache Solr Real-Time 7

Detects Solr Version.

Return value

returns solr versions of 4,3,1, Not recognized! or Not accessible!

1 call to apachesolr_realtime_solrversion()
apachesolr_realtime_commit in ./apachesolr_realtime.module
Commit Solr index making the document available.

File

./apachesolr_realtime.module, line 195
Module file for apachesolr_realtime

Code

function apachesolr_realtime_solrversion() {
  $env_id = apachesolr_default_environment();
  $solr = apachesolr_get_solr($env_id);
  try {

    // Get Solr version.
    $systeminfo = $solr
      ->getSolrVersion();
    if (preg_match("/^(4.\\d)/", $systeminfo)) {
      $solr_version = '4';
    }
    elseif (preg_match("/^(3.\\d)/", $systeminfo)) {
      $solr_version = '3';
    }
    elseif (preg_match("/^(1.\\d)/", $systeminfo)) {
      $solr_version = '1';
    }
    else {
      $solr_version = "Solr version not recognized!";
    }
    return $solr_version;
  } catch (Exception $e) {
    return "Solr Server not accessible!";
  }
}