Thursday, December 31, 2015

iOS Search API Best Practices



There are two categories of content. 

1. Private : Directly indexed using NSUserActivity and CoreSpotLight APIs. App can index content that user has created locally and this content remains in the user’s device and is searchable only locally. 

2. Public : Content that comes from the website. Apple uess a web crawler, called Applebot, to gather publicly available information that has been marked up using standard web markup techniques. This info is then presented to users when they use Search in iOS 9.0 or from Safari Suggestions. 

Which is the Right API to use? 

NSUserActivity : New methods and properties in the NSUserActivity class help one to index items from the app as the user does an activity in the app. This could include creating or visiting a piece of content, viewing a set of items such as visiting a navigation point. As the users do these activities in the app, the NSUSErActivity API can be used to indxed such actions. For e.g. Health app can add activities that let users search for “Steps” and be taken directly to that pane in the health app. 

Core Spotlight: The framework enables indexing of app content that is searchable privately on a persons device. One can add. delete , update and delete items in core spotlight index and that info will be searchable for easy access. Using a search extension, we can add content in the background even if app is not running. This allows the index to be up to date as the content changes even if the user activity isn’t actively using the app. This is for great things like messaging and conversations stored on the server but accessed through the app or locally generated content 

Web Markup: This is useful for apps that has mirrored content on the web. Applebot crawls the website and show its content on search results. By Implementing web markup we can make results look richer, increase engagement and seamless redirect users to specific content in the app. 

References:

No comments:

Post a Comment