SS 4.0 - Strip namespaces from core name since backslashes are not acceptable Solr core names

This commit is contained in:
elliot sawyer 2017-04-27 22:18:39 +12:00
parent a8588b2fd8
commit 815d619013
1 changed files with 3 additions and 1 deletions

View File

@ -4,6 +4,7 @@ namespace SilverStripe\FullTextSearch\Solr\Services;
use SilverStripe\Core\Config\Config;
use SilverStripe\FullTextSearch\Solr\Solr;
use Silverstripe\Core\ClassInfo;
Solr::include_client_api();
/**
@ -21,7 +22,8 @@ class SolrService extends SolrService_Core
protected function coreCommand($command, $core, $params = array())
{
$command = strtoupper($command);
//get the non-namespaced name of the Solr core, since backslashes not valid characters
$core = ClassInfo::shortName($core);
$params = array_merge($params, array('action' => $command, 'wt' => 'json'));
$params[$command == 'CREATE' ? 'name' : 'core'] = $core;