Skip to content

Commit

Permalink
Updating pantheon_apachesolr to report index size, implement getSolrV…
Browse files Browse the repository at this point in the history
…ersion.
  • Loading branch information
fluxsauce committed Apr 16, 2013
1 parent c78a636 commit 90bee6e
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ public function getStatsSummary() {
'@deletes_total' => '',
'@schema_version' => '',
'@core_name' => '',
'@index_size' => '',
);

if (!empty($stats)) {
Expand All @@ -286,6 +287,8 @@ public function getStatsSummary() {
$summary['@schema_version'] = trim($schema[0]);;
$core = $stats->xpath('/solr/core[1]');
$summary['@core_name'] = trim($core[0]);
$size_xpath = $stats->xpath('//stat[@name="indexSize"]');
$summary['@index_size'] = trim(current($size_xpath));
}

return $summary;
Expand Down Expand Up @@ -889,4 +892,19 @@ public function search($query = '', array $params = array(), $method = 'GET') {
throw new Exception("Unsupported method '$method' for search(), use GET or POST");
}
}

/**
* Get the current solr version.
*
* @return int
* Does not give a more detailed version; if needed use $system_info.
*/
public function getSolrVersion() {
$system_info = $this->getSystemInfo();
// Get the solr version number.
if (isset($system_info->lucene->{'solr-spec-version'})) {
return $system_info->lucene->{'solr-spec-version'}[0];
}
return 0;
}
}

0 comments on commit 90bee6e

Please sign in to comment.