[TIMOB-23828] iOS10: Support new CSSearchQuery APIs
GitHub Issue | n/a |
---|---|
Type | New Feature |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2016-08-29T07:32:19.000+0000 |
Affected Version/s | Release 5.5.0 |
Fix Version/s | Release 5.5.0 |
Components | iOS |
Labels | ios10, qe-5.5.0, searchquery |
Reporter | Eric Wieber |
Assignee | Hans Knöchel |
Created | 2016-08-25T21:31:00.000+0000 |
Updated | 2017-01-23T18:49:56.000+0000 |
Description
In https://developer.apple.com/reference/corespotlight/cssearchquery, iOS 10 offers new API's for the CoreSpotlight framework. In detail, these are new attributes for the CSSearchQuery to query an attribute set by it's attribute name.
Proposed API:
// The search-query
var searchQuery = Ti.App.iOS.createSearchQuery({
queryString: "Searchable*",
attributes: ["title", "displayName", "keywords", "contentType"]
});
// The event to be called when a new batch of items is found
searchQuery.addEventListener("founditems", function(e) {
// Get found items with e.items
});
// The event to be called when the search-query completes
searchQuery.addEventListener("completed", function(e) {
// Loop through your found items and access the searchable-item attribute-set
});
// Start the search-query (or use searchQuery.cancel()) to abort it
searchQuery.start();
Looks easy to expose and we can do that right next to the existing
[Ti.App.iOS.SearchableAttributeSet](http://docs.appcelerator.com/platform/latest/#!/api/Titanium.App.iOS.SearchableItemAttributeSet)
etc. -I will propose an API for it later today, probably on theTi.App.iOS.SearchQuery
namespace :-)- See the proposed API above.PR (master): https://github.com/appcelerator/titanium_mobile/pull/8276 PR (6_0_X): https://github.com/appcelerator/titanium_mobile/pull/8280 PR (5_5_X): https://github.com/appcelerator/titanium_mobile/pull/8281 Demo:
CR and FT passed! PRs merged!
Verified implemented, using: MacOS 10.12 (16A239m) Studio 4.7.1.201608190732 Ti SDK 5.5.0.v20160829003224 Appc NPM 4.2.7 Appc CLI 5.5.0-5 Xcode 8.0 (8S201h) Able to search for and properly return indexed app content. Tested using the sample code provided and modified versions of it. Searches return the correct information when searching through zero, one, or several apps who's content has been indexed previously.