mirror of
https://github.com/silverstripe/silverstripe-fulltextsearch
synced 2024-10-22 14:05:29 +02:00
Ensure only Namespaced format is used for Configure
This commit is contained in:
parent
b6e64a2ec4
commit
0764c0ed1e
@ -21,12 +21,7 @@ class SolrService extends SolrService_Core
|
||||
*/
|
||||
protected function coreCommand($command, $core, $params = array())
|
||||
{
|
||||
// Unencode the class name
|
||||
$core = SolrIndex::getClassNameFromIndex($core);
|
||||
|
||||
$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;
|
||||
|
||||
@ -40,17 +35,9 @@ class SolrService extends SolrService_Core
|
||||
*/
|
||||
public function coreIsActive($core)
|
||||
{
|
||||
// Unencode the class name
|
||||
$core = SolrIndex::getClassNameFromIndex($core);
|
||||
|
||||
// Request the status of the full core name
|
||||
$result = $this->coreCommand('STATUS', $core);
|
||||
|
||||
// Solr returns the core as the 'short name' of the class (e.g. Mysite\Search\SolrIndex -> SolrIndex)
|
||||
$reflection = new \ReflectionClass($core);
|
||||
$shortClass = $reflection->getShortName();
|
||||
|
||||
return isset($result->status->$shortClass->uptime);
|
||||
return isset($result->status->$core->uptime);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3,7 +3,6 @@
|
||||
namespace SilverStripe\FullTextSearch\Solr;
|
||||
|
||||
use SilverStripe\Control\Director;
|
||||
use SilverStripe\Core\ClassInfo;
|
||||
use SilverStripe\Core\Environment;
|
||||
use SilverStripe\FulltextSearch\Search\Indexes\SearchIndex;
|
||||
use SilverStripe\FullTextSearch\Search\Variants\SearchVariant_Caller;
|
||||
@ -1052,12 +1051,9 @@ abstract class SolrIndex extends SearchIndex
|
||||
*/
|
||||
public function uploadConfig($store)
|
||||
{
|
||||
// Ensure the short class name is used to match the call which creates the core in SolrService->coreCreate()
|
||||
$indexName = self::getClassNameFromIndex($this->getIndexName());
|
||||
$indexName = ClassInfo::shortName($indexName);
|
||||
// Upload the config files for this index
|
||||
$store->uploadString(
|
||||
$indexName,
|
||||
$this->getIndexName(),
|
||||
'schema.xml',
|
||||
(string)$this->generateSchema()
|
||||
);
|
||||
@ -1065,7 +1061,7 @@ abstract class SolrIndex extends SearchIndex
|
||||
// Upload additional files
|
||||
foreach (glob($this->getExtrasPath().'/*') as $file) {
|
||||
if (is_file($file)) {
|
||||
$store->uploadFile($indexName, $file);
|
||||
$store->uploadFile($this->getIndexName(), $file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user