mirror of
https://github.com/silverstripe/silverstripe-fulltextsearch
synced 2024-10-22 14:05:29 +02:00
Merge branch '3.6' into 3
This commit is contained in:
commit
277a307a1b
@ -99,6 +99,8 @@ abstract class SolrReindexBase implements SolrReindexHandler
|
||||
$batchSize,
|
||||
$taskName
|
||||
) {
|
||||
// Get current state
|
||||
$originalState = SearchVariant::current_state();
|
||||
// Set state
|
||||
SearchVariant::activate_state($state);
|
||||
|
||||
@ -122,6 +124,9 @@ abstract class SolrReindexBase implements SolrReindexHandler
|
||||
for ($group = 0; $group < $groups; $group++) {
|
||||
$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
|
||||
Environment::increaseTimeLimitTo();
|
||||
// Get current state
|
||||
$originalState = SearchVariant::current_state();
|
||||
// Set state
|
||||
SearchVariant::activate_state($state);
|
||||
|
||||
$logger->info("Adding $class");
|
||||
|
||||
// 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));
|
||||
|
||||
// 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
|
||||
DB::query('SELECT 1');
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user