BUG: Fixed configuration not working for multiple indexes.
This commit is contained in:
parent
f2b100aa6a
commit
8374c77df0
|
@ -86,11 +86,23 @@ class Solr_Configure extends BuildTask {
|
|||
|
||||
$remote = null;
|
||||
|
||||
$configure = function($index) use($service) {
|
||||
if ($service->coreIsActive($index)) {
|
||||
echo "Reloading configuration...";
|
||||
$service->coreReload($index);
|
||||
echo "done\n";
|
||||
} else {
|
||||
echo "Creating configuration...";
|
||||
$service->coreCreate($index, "$remote/$index");
|
||||
echo "done\n";
|
||||
}
|
||||
};
|
||||
|
||||
switch ($index['mode']) {
|
||||
case 'file':
|
||||
$local = $index['path'];
|
||||
$remote = isset($index['remotepath']) ? $index['remotepath'] : $local;
|
||||
|
||||
|
||||
foreach (Solr::get_indexes() as $index => $instance) {
|
||||
$confdir = "$local/$index/conf";
|
||||
if (!is_dir($confdir)) mkdir($confdir, 0770, true);
|
||||
|
@ -100,8 +112,10 @@ class Solr_Configure extends BuildTask {
|
|||
foreach (glob(Director::baseFolder().'/fulltextsearch/conf/extras/*') as $file) {
|
||||
if (is_file($file)) copy($file, $confdir.'/'.basename($file));
|
||||
}
|
||||
|
||||
$configure($index);
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
|
||||
case 'webdav':
|
||||
|
@ -111,7 +125,7 @@ class Solr_Configure extends BuildTask {
|
|||
Solr::$solr_options['host'] . ':' . Solr::$solr_options['port'],
|
||||
$index['path']
|
||||
));
|
||||
|
||||
|
||||
$remote = $index['remotepath'];
|
||||
|
||||
foreach (Solr::get_indexes() as $index => $instance) {
|
||||
|
@ -126,23 +140,15 @@ class Solr_Configure extends BuildTask {
|
|||
foreach (glob(Director::baseFolder().'/fulltextsearch/conf/extras/*') as $file) {
|
||||
if (is_file($file)) WebDAV::upload_from_file($file, $confdir.'/'.basename($file));
|
||||
}
|
||||
|
||||
$configure($index);
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
user_error('Unknown Solr index mode '.$index['mode'], E_USER_ERROR);
|
||||
}
|
||||
|
||||
if ($service->coreIsActive($index)) {
|
||||
echo "Reloading configuration...";
|
||||
$service->coreReload($index);
|
||||
echo "done\n";
|
||||
} else {
|
||||
echo "Creating configuration...";
|
||||
$service->coreCreate($index, "$remote/$index");
|
||||
echo "done\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -174,7 +180,7 @@ class Solr_Reindex extends BuildTask {
|
|||
|
||||
foreach ($instance->getClasses() as $class => $options) {
|
||||
$includeSubclasses = $options['include_children'];
|
||||
|
||||
|
||||
foreach (SearchVariant::reindex_states($class, $includeSubclasses) as $state) {
|
||||
SearchVariant::activate_state($state);
|
||||
|
||||
|
@ -194,7 +200,7 @@ class Solr_Reindex extends BuildTask {
|
|||
|
||||
for ($offset = 0; $offset < $total; $offset += $this->stat('recordsPerRequest')) {
|
||||
echo "$offset..";
|
||||
|
||||
|
||||
$cmd = "php $script dev/tasks/$self index=$index class=$class start=$offset variantstate=$statevar";
|
||||
$res = `$cmd`;
|
||||
if (isset($_GET['verbose'])) {
|
||||
|
|
Loading…
Reference in New Issue