mirror of
https://github.com/silverstripe/silverstripe-fulltextsearch
synced 2024-10-22 14:05:29 +02:00
Allow limiting of classes on Solr_Reindex task
This commit is contained in:
parent
a50d9cf553
commit
bdc8c5a29d
@ -182,9 +182,15 @@ class Solr_Reindex extends BuildTask {
|
||||
foreach (Solr::get_indexes() as $index => $instance) {
|
||||
echo "Rebuilding {$instance->getIndexName()}\n\n";
|
||||
|
||||
Solr::service($index)->deleteByQuery('*:*');
|
||||
$classes = $instance->getClasses();
|
||||
if($request->getVar('class')) {
|
||||
$limitClasses = explode(',', $request->getVar('class'));
|
||||
$classes = array_intersect_key($classes, array_combine($limitClasses, $limitClasses));
|
||||
}
|
||||
|
||||
foreach ($instance->getClasses() as $class => $options) {
|
||||
Solr::service($index)->deleteByQuery('ClassHierarchy:(' . implode(' OR ', array_keys($classes)) . ')');
|
||||
|
||||
foreach ($classes as $class => $options) {
|
||||
$includeSubclasses = $options['include_children'];
|
||||
|
||||
foreach (SearchVariant::reindex_states($class, $includeSubclasses) as $state) {
|
||||
|
Loading…
Reference in New Issue
Block a user