mirror of
https://github.com/silverstripe/silverstripe-fulltextsearch
synced 2024-10-22 12:05:29 +00:00
Merge branch '3.6' into 3
This commit is contained in:
commit
277a307a1b
@ -99,6 +99,8 @@ abstract class SolrReindexBase implements SolrReindexHandler
|
|||||||
$batchSize,
|
$batchSize,
|
||||||
$taskName
|
$taskName
|
||||||
) {
|
) {
|
||||||
|
// Get current state
|
||||||
|
$originalState = SearchVariant::current_state();
|
||||||
// Set state
|
// Set state
|
||||||
SearchVariant::activate_state($state);
|
SearchVariant::activate_state($state);
|
||||||
|
|
||||||
@ -122,6 +124,9 @@ abstract class SolrReindexBase implements SolrReindexHandler
|
|||||||
for ($group = 0; $group < $groups; $group++) {
|
for ($group = 0; $group < $groups; $group++) {
|
||||||
$this->processGroup($logger, $indexInstance, $state, $class, $groups, $group, $taskName);
|
$this->processGroup($logger, $indexInstance, $state, $class, $groups, $group, $taskName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Reset state to originalState
|
||||||
|
SearchVariant::activate_state($originalState);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -168,7 +173,11 @@ abstract class SolrReindexBase implements SolrReindexHandler
|
|||||||
) {
|
) {
|
||||||
// Set time limit and state
|
// Set time limit and state
|
||||||
Environment::increaseTimeLimitTo();
|
Environment::increaseTimeLimitTo();
|
||||||
|
// Get current state
|
||||||
|
$originalState = SearchVariant::current_state();
|
||||||
|
// Set state
|
||||||
SearchVariant::activate_state($state);
|
SearchVariant::activate_state($state);
|
||||||
|
|
||||||
$logger->info("Adding $class");
|
$logger->info("Adding $class");
|
||||||
|
|
||||||
// Prior to adding these records to solr, delete existing solr records
|
// Prior to adding these records to solr, delete existing solr records
|
||||||
@ -187,6 +196,9 @@ abstract class SolrReindexBase implements SolrReindexHandler
|
|||||||
}
|
}
|
||||||
$logger->info("Updated " . implode(',', $processed));
|
$logger->info("Updated " . implode(',', $processed));
|
||||||
|
|
||||||
|
// Reset state to originalState
|
||||||
|
SearchVariant::activate_state($originalState);
|
||||||
|
|
||||||
// This will slow down things a tiny bit, but it is done so that we don't timeout to the database during a reindex
|
// This will slow down things a tiny bit, but it is done so that we don't timeout to the database during a reindex
|
||||||
DB::query('SELECT 1');
|
DB::query('SELECT 1');
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user