From b6e64a2ec4eb08de1013c389b07e2392fcd2fa08 Mon Sep 17 00:00:00 2001 From: jovenden Date: Thu, 8 Mar 2018 12:56:43 +1300 Subject: [PATCH] Fix issue where schema.xml etc is put in a different dir than the core is instantiated in --- src/Solr/SolrIndex.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Solr/SolrIndex.php b/src/Solr/SolrIndex.php index ef3a82b7..6311a5f8 100644 --- a/src/Solr/SolrIndex.php +++ b/src/Solr/SolrIndex.php @@ -3,6 +3,7 @@ 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; @@ -1051,9 +1052,12 @@ public function setService(SolrService $service) */ 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( - $this->getIndexName(), + $indexName, 'schema.xml', (string)$this->generateSchema() ); @@ -1061,7 +1065,7 @@ public function uploadConfig($store) // Upload additional files foreach (glob($this->getExtrasPath().'/*') as $file) { if (is_file($file)) { - $store->uploadFile($this->getIndexName(), $file); + $store->uploadFile($indexName, $file); } } }