Fix #134 - archiving and unpublishing now removes Live variant of versioned items from index

This commit is contained in:
Darren Inwood 2017-03-07 15:03:16 +13:00
parent 51749c603a
commit d40714614f
1 changed files with 30 additions and 0 deletions

View File

@ -66,6 +66,36 @@ class SearchVariantVersioned extends SearchVariant
}
}
/**
* If we are doing a delete or an unpublish where the *_Live table had a
* delete operation, this isn't included in the database manipulation array.
*
* We need to ensure each state is checked on every write.
*/
public function extractManipulationWriteState(&$writes)
{
$self = get_class($this);
foreach ($writes as $key => $write) {
$applies = $this->appliesTo($write['class'], true);
if (!$applies) {
continue;
}
$reindexStates = $this->reindexStates();
$next = array();
foreach ($write['statefulids'] as $i => $statefulid) {
// Add copies of the state to write with all possible Versioned states
foreach ($reindexStates as $reindexState) {
$reindexStatefulid = $statefulid;
$reindexStatefulid['state'][$self] = $reindexState;
$next[] = $reindexStatefulid;
}
}
$writes[$key]['statefulids'] = $next;
}
}
public function extractStates(&$table, &$ids, &$fields)
{
$class = $table;