iOS NSCoreDataCoreSpotlightDelegate, how to reindex all items

I have implemented NSCoreDataCoreSpotlightDelegate, and I missed out the part where the default expirationDate is 1 month, now items that I have added 3 months ago are not showing up in the search index.


How do I get NSCoreDataCoreSpotlightDelegate to reindex all the items?


I used to be able to call this:


mcdcsd.searchableIndex(CSSearchableIndex.default(), reindexAllSearchableItemsWithAcknowledgementHandler: {})

And the first time, it will reindex all the items, but if I re-run the app with the above line uncommented again, it will not reindex.

If I uninstall the app, install back, then uncomment the above line, then it will index all again for the first time.

How do I get it to reindex everything again?

Replies

I know this thread is quite old but I wanted to call your attention to the fact the NSCoreDataCoreSpotlightDelegate object has been updated with new features and functionality! In our session, "Showcase App Data in Spotlight", you'll:

  • Discover how Core Data can surface data from your app in Spotlight with as little as two lines of code.
  • Learn how to make that data discoverable in Spotlight search and to customize how it is presented to people on device.
  • See how to implement full-text search within your app, driven completely with the data indexed by Spotlight.

We've released a [sample application](Showcase App Data in Spotlight) and updated our documentation to demonstrate how these new capabilities work.

For more information be sure to watch our session Showcase App Data in Spotlight on Wednesday.

Hi, I saw your answer that you use core Data to implement Core Spotlight and it works fine. (https://developer.apple.com/forums/thread/734996?answerId=769626022#769626022 ) Can you give me your spotlight complete code with git hub link ? Thanks a lot!