protected function Drupal_Apache_Solr_Service::setStats in Apache Solr Search 5.2
Same name and namespace in other branches
- 6 Drupal_Apache_Solr_Service.php \Drupal_Apache_Solr_Service::setStats()
- 6.2 Drupal_Apache_Solr_Service.php \Drupal_Apache_Solr_Service::setStats()
Sets $this->stats with the information about the Solr Core form /admin/stats.jsp
1 call to Drupal_Apache_Solr_Service::setStats()
- Drupal_Apache_Solr_Service::getStats in ./
Drupal_Apache_Solr_Service.php - Get information about the Solr Core.
File
- ./
Drupal_Apache_Solr_Service.php, line 87
Class
Code
protected function setStats() {
$data = $this
->getLuke();
// Only try to get stats if we have connected to the index.
if (empty($this->stats) && isset($data->index->numDocs)) {
$url = $this
->_constructUrl(self::STATS_SERVLET);
$this->stats_cid = "apachesolr:stats:" . md5($url);
$cache = cache_get($this->stats_cid, 'cache_apachesolr');
if (isset($cache->data)) {
$this->stats = simplexml_load_string(unserialize($cache->data));
}
else {
$response = $this
->_sendRawGet($url);
$this->stats = simplexml_load_string($response
->getRawResponse());
cache_set($this->stats_cid, 'cache_apachesolr', serialize($response
->getRawResponse()));
}
}
}