Fix issue where schema.xml etc is put in a different dir than the core is instantiated in

This commit is contained in:
jovenden 2018-03-08 12:56:43 +13:00
parent 48f3df725a
commit b6e64a2ec4
1 changed files with 6 additions and 2 deletions

View File

@ -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 @@ 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(
$this->getIndexName(),
$indexName,
'schema.xml',
(string)$this->generateSchema()
);
@ -1061,7 +1065,7 @@ abstract class SolrIndex extends SearchIndex
// Upload additional files
foreach (glob($this->getExtrasPath().'/*') as $file) {
if (is_file($file)) {
$store->uploadFile($this->getIndexName(), $file);
$store->uploadFile($indexName, $file);
}
}
}