Search code examples
iosobjective-creact-nativespotlightcorespotlight

Spotlight IOS linked to API


I'm developping a mobile application for ios device and i have an issue!

My app contain a search system and i want to expose my system into spotlight in IOS. I had found some informations but it's to put some selected item ! It's not dynamic ! Our database contains more than 100 000 rows. So it's not possible to put every data in spotlight search engine !

So, my question is that, can i linked Spotlight to my API to allow my users to search directely in spotlight?

Thank!


Solution

  • While Spotlight does handle fairly big amounts of entries (in the order of hundreds to thousands), it's a good idea not trying to put ~100.000 entries in there (also because your app would be in charge to update them over time).

    You could think of adding "proxy" entries to Spotlight, e.g., your data/domain categories. If you were to implement an accomodation booking app, you could add entries like "Hotel", "Hostel" and many more (including specific entries like the top items and user-selected favorites/current bookings) into Spotlight, along with appropriate keywords for each. If a user selects one of those in Spotlight, your app will open and can perform the actual search.

    In iOS 10, there's a dedicated API for continuing Spotlight searches. You still have to provide a Spotlight entry first that matches the user's search term in Spotlight, so it's not all that different from the approach I outlined above.

    There's no way to search within your app as the user types into Spotlight.