8 Replies
      Latest reply on Dec 29, 2015 4:15 AM by SPopenko
      Level 1 Level 1 (0 points)

        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.png How can I do it from code?

         

        Thanks in advanced!

        • Re: Spotlight Index Extension
          pdm Apple Staff Apple Staff (1,770 points)

          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. 

            • Re: Spotlight Index Extension
              pdm Apple Staff Apple Staff (1,770 points)

              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. 

              • Re: Spotlight Index Extension
                cwagdev Level 1 Level 1 (20 points)

                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.

              • Re: Spotlight Index Extension
                daniesy Level 1 Level 1 (0 points)

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