Pass through Apache_Solr_Response from SolrService

Useful for detailed success status
(failures are handled through exceptions)
This commit is contained in:
Ingo Schommer 2012-07-19 17:17:30 +02:00
parent 566791655c
commit fd8c721799
1 changed files with 14 additions and 2 deletions

View File

@ -4,6 +4,9 @@ Solr::include_client_api();
class SolrService extends Apache_Solr_Service {
/**
* @return Apache_Solr_Response
*/
protected function coreCommand($command, $core, $params=array()) {
$command = strtoupper($command);
@ -13,22 +16,31 @@ class SolrService extends Apache_Solr_Service {
return $this->_sendRawGet($this->_constructUrl('admin/cores', $params));
}
/**
* @return boolean
*/
public function coreIsActive($core) {
$result = $this->coreCommand('STATUS', $core);
return isset($result->status->$core->uptime);
}
/**
* @return Apache_Solr_Response
*/
public function coreCreate($core, $instancedir, $config=null, $schema=null, $datadir=null) {
$args = array('instanceDir' => $instancedir);
if ($config) $args['config'] = $config;
if ($schema) $args['schema'] = $schema;
if ($datadir) $args['dataDir'] = $datadir;
$this->coreCommand('CREATE', $core, $args);
return $this->coreCommand('CREATE', $core, $args);
}
/**
* @return Apache_Solr_Response
*/
public function coreReload($core) {
$this->coreCommand('RELOAD', $core);
return $this->coreCommand('RELOAD', $core);
}
protected $_serviceCache = array();