Skip to content

Commit

Permalink
Update index when adding/removing node assignment (#1353)
Browse files Browse the repository at this point in the history
In the back-end, when you add a new location to an existing content, or remove one, the search index is not updated.
  • Loading branch information
vnivuahc authored and andrerom committed Jun 28, 2018
1 parent 4fcd80c commit d1ed2aa
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions kernel/content/ezcontentoperationcollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -823,6 +823,11 @@ static public function addAssignment( $nodeID, $objectID, $selectedNodeIDArray )

eZContentCacheManager::clearContentCacheIfNeeded( $objectID );

if ( !eZSearch::getEngine() instanceof eZSearchEngine )
{
eZContentOperationCollection::registerSearchObject( $objectID );
}

return array( 'status' => true );
}

Expand Down Expand Up @@ -902,6 +907,13 @@ static public function removeNodes( array $removeNodeIdList )
{
eZUser::purgeUserCacheByUserId( $object->attribute( 'id' ) );
}

// Give other search engines that the default one a chance to reindex
// when removing locations.
if ( !eZSearch::getEngine() instanceof eZSearchEngine )
{
eZContentOperationCollection::registerSearchObject( $objectId );
}
}

// Triggering content/cache filter for Http cache purge
Expand Down Expand Up @@ -1125,6 +1137,10 @@ static public function swapNode( $nodeID, $selectedNodeID, $nodeIdList = array()

// clear cache for new placement.
eZContentCacheManager::clearContentCacheIfNeeded( $objectID );
if ( !eZSearch::getEngine() instanceof eZSearchEngine )
{
eZContentOperationCollection::registerSearchObject( $objectID );
}

eZSearch::swapNode( $nodeID, $selectedNodeID, $nodeIdList = array() );

Expand Down Expand Up @@ -1256,11 +1272,14 @@ static public function updatePriority( $parentNodeID, $priorityArray = array(),
*
* @return array An array with operation status, always true
*/
static public function updateMainAssignment( $mainAssignmentID, $ObjectID, $mainAssignmentParentID )
static public function updateMainAssignment( $mainAssignmentID, $objectID, $mainAssignmentParentID )
{
eZContentObjectTreeNode::updateMainNodeID( $mainAssignmentID, $ObjectID, false, $mainAssignmentParentID );
eZContentCacheManager::clearContentCacheIfNeeded( $ObjectID );
eZContentOperationCollection::registerSearchObject( $ObjectID );
eZContentObjectTreeNode::updateMainNodeID( $mainAssignmentID, $objectID, false, $mainAssignmentParentID );
eZContentCacheManager::clearContentCacheIfNeeded( $objectID );
if ( !eZSearch::getEngine() instanceof eZSearchEngine )
{
eZContentOperationCollection::registerSearchObject( $objectID );
}

return array( 'status' => true );
}
Expand Down

0 comments on commit d1ed2aa

Please sign in to comment.