mirror of
https://github.com/silverstripe/silverstripe-fulltextsearch
synced 2024-10-22 14:05:29 +02:00
API Remove deprecated code
This commit is contained in:
parent
7f564956a5
commit
bd405c622a
@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace SilverStripe\FullTextSearch\Solr\Tasks;
|
namespace SilverStripe\FullTextSearch\Solr\Tasks;
|
||||||
|
|
||||||
use ReflectionClass;
|
use ReflectionClass;
|
||||||
@ -19,7 +20,6 @@ use SilverStripe\FullTextSearch\Solr\SolrIndex;
|
|||||||
* - verbose (optional)
|
* - verbose (optional)
|
||||||
*
|
*
|
||||||
* When running with a single batch, provide the following querystring arguments:
|
* When running with a single batch, provide the following querystring arguments:
|
||||||
* - start
|
|
||||||
* - index
|
* - index
|
||||||
* - class
|
* - class
|
||||||
* - variantstate
|
* - variantstate
|
||||||
@ -90,16 +90,6 @@ class Solr_Reindex extends Solr_BuildTask
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deprecated reindex mechanism
|
|
||||||
$start = $request->getVar('start');
|
|
||||||
if ($start !== null) {
|
|
||||||
// Run single batch directly
|
|
||||||
$indexInstance = singleton($index);
|
|
||||||
$state = json_decode($request->getVar('variantstate'), true);
|
|
||||||
$this->runFrom($indexInstance, $class, $start, $state);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if we are re-indexing a single group
|
// Check if we are re-indexing a single group
|
||||||
// If not using queuedjobs, we need to invoke Solr_Reindex as a separate process
|
// If not using queuedjobs, we need to invoke Solr_Reindex as a separate process
|
||||||
// Otherwise each group is processed via a SolrReindexGroupJob
|
// Otherwise each group is processed via a SolrReindexGroupJob
|
||||||
@ -120,39 +110,4 @@ class Solr_Reindex extends Solr_BuildTask
|
|||||||
$taskName = $this->config()->segment ?: get_class($this);
|
$taskName = $this->config()->segment ?: get_class($this);
|
||||||
$handler->triggerReindex($this->getLogger(), $this->config()->recordsPerRequest, $taskName, $class);
|
$handler->triggerReindex($this->getLogger(), $this->config()->recordsPerRequest, $taskName, $class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated since version 2.0.0
|
|
||||||
*/
|
|
||||||
protected function runFrom($index, $class, $start, $variantstate)
|
|
||||||
{
|
|
||||||
DeprecationTest_Deprecation::notice('2.0.0', 'Solr_Reindex now uses a new grouping mechanism');
|
|
||||||
|
|
||||||
// Set time limit and state
|
|
||||||
increase_time_limit_to();
|
|
||||||
SearchVariant::activate_state($variantstate);
|
|
||||||
|
|
||||||
// Generate filtered list
|
|
||||||
$items = DataList::create($class)
|
|
||||||
->limit($this->config()->recordsPerRequest, $start);
|
|
||||||
|
|
||||||
// Add child filter
|
|
||||||
$classes = $index->getClasses();
|
|
||||||
$options = $classes[$class];
|
|
||||||
if (!$options['include_children']) {
|
|
||||||
$items = $items->filter('ClassName', $class);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Process selected records in this class
|
|
||||||
$this->getLogger()->info("Adding $class");
|
|
||||||
foreach ($items->sort("ID") as $item) {
|
|
||||||
$this->getLogger()->debug($item->ID);
|
|
||||||
|
|
||||||
// See SearchUpdater_ObjectHandler::triggerReindex
|
|
||||||
$item->triggerReindex();
|
|
||||||
$item->destroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->getLogger()->info("Done");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user