$command, 'wt' => 'json')); $params[$command === 'CREATE' ? 'name' : 'core'] = $core; return $this->_sendRawGet($this->_constructUrl('admin/cores', $params)); } /** * Is the passed core active? * * @param string $core The name of the core (an encoded class name) * @return boolean True if that core exists & is active */ public function coreIsActive($core) { // Request the status of the full core name $result = $this->coreCommand('STATUS', $core); return isset($result->status->$core->uptime); } /** * Create a new core * * @param string $core The name of the core * @param string $instancedir The base path of the core on the server * @param string $config The filename of solrconfig.xml on the server. Default is $instancedir/solrconfig.xml * @param string $schema The filename of schema.xml on the server. Default is $instancedir/schema.xml * @param string $datadir The path to store data for this core on the server. Default depends on solrconfig.xml * @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; } return $this->coreCommand('CREATE', $core, $args); } /** * Reload a core * * @param string $core The name of the core * @return Apache_Solr_Response */ public function coreReload($core) { return $this->coreCommand('RELOAD', $core); } /** * Create a new Solr4Service_Core instance for the passed core * * @param string $core The name of the core * @return Solr4Service_Core */ public function serviceForCore($core) { $klass = Config::inst()->get(get_called_class(), 'core_class'); return new $klass($this->_host, $this->_port, $this->_path . $core, $this->_httpTransport); } }