Skip to content

Commit

Permalink
Fix issue where schema.xml etc is put in a different dir than the cor…
Browse files Browse the repository at this point in the history
…e is instantiated in
  • Loading branch information
jovenden committed Mar 7, 2018
1 parent 48f3df7 commit b6e64a2
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Solr/SolrIndex.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -1051,17 +1052,20 @@ 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()
);

// Upload additional files
foreach (glob($this->getExtrasPath().'/*') as $file) {
if (is_file($file)) {
$store->uploadFile($this->getIndexName(), $file);
$store->uploadFile($indexName, $file);
}
}
}
Expand Down

0 comments on commit b6e64a2

Please sign in to comment.