Share » Forums » Extensions » eZ Find » Deleting an object via the API and...

Deleting an object via the API and delayed indexing

Deleting an object via the API and delayed indexing

Wednesday 09 December 2009 11:11:59 am - 2 replies

Author Message

Paul Borgermans

Saturday 12 December 2009 4:59:00 am

Yes, there is an API in eZ Find (or any search plugin):

Before you actually remove the objects from eZ Publish, use something like this:

$searchEngine = new eZSolr();
....
//loop over objets to delete
$searchEngine->removeObject( $contentObject, false );

And call a commit at the end:

$searchEngine->commit();

eZ Publish, eZ Find, Solr expert consulting and training
http://twitter.com/paulborgermans

Bertrand Dunogier

Saturday 12 December 2009 6:20:12 am

Running eZContentObject::expireAllCache() is unnecessary, and actually a bit dangerous ! It completely expires all content-cache and cache-blocks... I don't feel like it is what you need.

What you could do instead is use eZContentObjectTreeNode::removeSubtrees() with the $moveToTrash parameter set to false:

eZContentObjectTreNode::removeSubtrees( $nodeIDArray, $moveToTrash = false, $infoOnly = true );

It will take care of everything for you, including clearing appropriate caches and removing the object from the search engine index.

Bertrand Dunogier
eZ Systems Engineering, Lyon
http://twitter.com/bdunogier
http://gplus.to/BertrandDunogier

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu