Spotlight Index Extension

Hello.


I've been trying to understand Spotlight Index Extension, but I haven't found any information about it in WWDC videos and in this forum. So I have some questions about it:

  1. When exactly extension methods are called?
  2. How is it possible to test them on the simulator or on a devide?
  3. As far as I understand extensions, an extension and an app have different local storages, so should I use AppGroups to store my data to make possible for my extension to reindex data?
  4. Does anybody know, why CoreSpotlight API doesn't work if I don't provide itemContentType to CSSearchableItemAttributeSet?
  5. Is it possible to download something from the Internet within extension methods?
  6. On WWDC Apple showed that it is possible to make spotlight results actionable http://i.imgur.com/W1g3mH5.pngHow can I do it from code?


Thanks in advanced!

Replies

Some answers to your questions.


When the extension methods get called is an implementation detail, but your point about being able to test them is well taken. I am trying to get more details in this area and will post them here in the forums when I have them. In the meantime, my recommendation woudl be to factor out your searching code into a shared framework that both your app and your search extension can use. This would allow you to test the code in the context of your app in the interim.


Yes, apps and their extensions have separate sandboxes. You would want to use a shared app group container for any shared data that might be necessary to accomplish re-indexing from the extension. And again, factoring out any common code into a shared framework can help simplify things like accessing resources in your group container.


With regard to the content type, I don't know the answer to why it wouldn't work. Please file a bug report (and post the number here). If you can provide a small test project that would expedite the bug.


Yes, it is possible to download things from an extension. Extensions are typically fairly short lived so you likely won't have a lot of time. You might check out the WWDC video WatchKit Tips and Tricks where Jake talks about this in the context of a WatchKit extension, but the same would hold here.


For adding actions to results, let me do a little more digging on that and I'll post a followup.

To follow up on this, it's currently not possible to add actionable items by way of CoreSpotlight. Those would need to come through the web markup path. Please file a bug report if this is something you want to see.


Also, did you file a bug report about the content type issue, or were you able to get that to work? I was just trying a quick test and things seem to be working for me without setting a content type.

Wow, that's a huge oversight. I filed 21828862

Any updates on testing this?


Also, it would be nice to get a little bit of insight as to when the extension might be invoked. I understand if the exact details cannot be shared. But something would be nice.


Is it a routine thing that iOS does on some regular interval?

Is it something that happens when the user searches in Spotlight/Safari?


Just trying to get an idea of what the frequency might be.

But what is actually the purpose of Spotlight Index extension? How can there be no documentation on this feature?

Hey,


Did you guys figure this out? Currently I index stuff myself within my app. What is the purpose of that extension then?

Any update for testing Spotlight extentions?

Any usefull sources with the description how this extention works and what is it purpose of it will be nice to post here 🙂 Guys if you have, please share.