When to purge the persistent history?

I enjoyed the video thanks. At 6mins when David said "You don't need to do anything else and your data will be indexed in Spotlight.". What immediately came to mind was what about cleaning up the persistent history?

I had a brief look at the docs and noticed that indexDidUpdateNotification includes NSPersistentHistoryTokenKey should we listen for that and then purge the history?

And what if we have multiple components requiring use of the persistent history? Is there a recommended strategy for deleting only the history not required by the Spotlight indexer and other components?

Hi malc,

The NSCoreDataCoreSpotlightDelegate uses the persistent history token to keep track of where it is in the indexing process. If you delete the persistent history, it is possible that the spotlight delegate may get confused about where it is in that process and may need to start over.

Can you elaborate on why you're needing to purge the persistent history?

-d

Hi I'm not talking about purging all the history, only the history that is no longer needed because the NSCoreDataCoreSpotlightDelegate has already moved past it. As explained in the link I included (included again below), we have to purge the unneeded history otherwise we are wasting disk space.

Purge History

Because persistent history tracking transactions take up space on disk, determine a clean-up strategy to remove them when they > are no longer needed. Before pruning history, a single gatekeeper should ensure that your app and its clients have consumed the history they need.

From Consuming Relevant Store Changes

When to purge the persistent history?
 
 
Q