mirror of
https://github.com/silverstripe/silverstripe-fulltextsearch
synced 2024-10-22 14:05:29 +02:00
Pass through Apache_Solr_Response from SolrService
Useful for detailed success status (failures are handled through exceptions)
This commit is contained in:
parent
566791655c
commit
fd8c721799
@ -4,6 +4,9 @@ Solr::include_client_api();
|
|||||||
|
|
||||||
class SolrService extends Apache_Solr_Service {
|
class SolrService extends Apache_Solr_Service {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Apache_Solr_Response
|
||||||
|
*/
|
||||||
protected function coreCommand($command, $core, $params=array()) {
|
protected function coreCommand($command, $core, $params=array()) {
|
||||||
$command = strtoupper($command);
|
$command = strtoupper($command);
|
||||||
|
|
||||||
@ -13,22 +16,31 @@ class SolrService extends Apache_Solr_Service {
|
|||||||
return $this->_sendRawGet($this->_constructUrl('admin/cores', $params));
|
return $this->_sendRawGet($this->_constructUrl('admin/cores', $params));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
public function coreIsActive($core) {
|
public function coreIsActive($core) {
|
||||||
$result = $this->coreCommand('STATUS', $core);
|
$result = $this->coreCommand('STATUS', $core);
|
||||||
return isset($result->status->$core->uptime);
|
return isset($result->status->$core->uptime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Apache_Solr_Response
|
||||||
|
*/
|
||||||
public function coreCreate($core, $instancedir, $config=null, $schema=null, $datadir=null) {
|
public function coreCreate($core, $instancedir, $config=null, $schema=null, $datadir=null) {
|
||||||
$args = array('instanceDir' => $instancedir);
|
$args = array('instanceDir' => $instancedir);
|
||||||
if ($config) $args['config'] = $config;
|
if ($config) $args['config'] = $config;
|
||||||
if ($schema) $args['schema'] = $schema;
|
if ($schema) $args['schema'] = $schema;
|
||||||
if ($datadir) $args['dataDir'] = $datadir;
|
if ($datadir) $args['dataDir'] = $datadir;
|
||||||
|
|
||||||
$this->coreCommand('CREATE', $core, $args);
|
return $this->coreCommand('CREATE', $core, $args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Apache_Solr_Response
|
||||||
|
*/
|
||||||
public function coreReload($core) {
|
public function coreReload($core) {
|
||||||
$this->coreCommand('RELOAD', $core);
|
return $this->coreCommand('RELOAD', $core);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected $_serviceCache = array();
|
protected $_serviceCache = array();
|
||||||
|
Loading…
Reference in New Issue
Block a user