corespotlight

How to delete a specific NSUserActivity search index?

隐身守侯 提交于 2020-01-04 10:05:24
问题 I use NSUserActivity to index a user activity for searching. I found a solution to delete a specific NSUserActivity , assign a CSSearchableItemAttributeSet with relatedUniqueIdentifier to NSUserActivity : let attributeSet = CSSearchableItemAttributeSet(itemContentType: kUTTypeContact as String) attributeSet.relatedUniqueIdentifier = objectId let activity = NSUserActivity(activityType: Employee.domainIdentifier) activity.title = name activity.userInfo = userActivityUserInfo activity.keywords =

What is the basic difference between using NSUserActivity & CoreSpotlight framework for Search programming? How to choose among them?

扶醉桌前 提交于 2020-01-03 18:55:08
问题 How to decide which one is most suitable among CoreSpotlight framework & NSUserActivity for Search Programming. 回答1: CoreSpotlight does not require users to visit the content in order to index it (index content at any point) private on-device index (you don’t use Core Spotlight APIs to make items publicly searchable) NSUserActivity can index only as users perform activities in your app public/private indexing indexing navigation points 回答2: In addition to @sash 's answer, you may want to

Core Spotlight Userinfo is always empty

假装没事ソ 提交于 2020-01-03 14:16:49
问题 I am using a combination of CoreSpotlight api and NSUserActivity api to index app content. Everything goes well until I tap a search result. The userInfo passed with userActivity in continueUserActivity method contains only one item i.e kCSSearchableItemActivityIdentifier . My other custom keys are nil. Here is my code for indexing items.. class MyTestViewController:UIViewController{ viewDidLoad(){ searchHandler = SearchHandler() searchHandler.index(items) } } class SearchHandler{ var

Error while using CoreSpotlight

ε祈祈猫儿з 提交于 2019-12-24 07:52:07
问题 I am using corespotlight framework in my OSX application on MacOS 10.13 (17A405) as below: var searchableItems = [CSSearchableItem]() let attr = CSSearchableItemAttributeSet(itemContentType: kUTTypeImage as String) attr.title = "Test item" attr.contentDescription = "Test item description" let searchableItem = CSSearchableItem(uniqueIdentifier: "123", domainIdentifier: "com.myapp.search", attributeSet: attr) searchableItems.append(searchableItem) CSSearchableIndex.default()

iOS NSCoreDataCoreSpotlightDelegate, how to reindex all items

时光毁灭记忆、已成空白 提交于 2019-12-23 04:13:36
问题 I have implemented NSCoreDataCoreSpotlightDelegate, and I missed out the part where the default expirationDate is 1 month, now items that I have added 3 months ago are not showing up in the search index. How do I get NSCoreDataCoreSpotlightDelegate to reindex all the items? I used to be able to call this: let container = NSPersistentContainer(name: "MyApp") let psd = NSPersistentStoreDescription(url: FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: "group.com.kiwlm

How to get custom value back from Spotlight with CSCustomAttributeKey

时光总嘲笑我的痴心妄想 提交于 2019-12-22 05:19:30
问题 I am trying to get some data back from Core Spotlight which I am storing using a custom attribute key. Tested this on macOS and iOS as well, the result is always the same. My test class: import CoreSpotlight class SpotlightSearch { let domainId = "com.company.some" let originalDataKeyName: String init() { self.originalDataKeyName = domainId.replacingOccurrences(of: ".", with: "_") + "_originalData" } func addToIndex(title: String, content: String) { guard let originalDataKey =

CoreSpotlight indexing

核能气质少年 提交于 2019-12-21 12:52:14
问题 Hi I'm trying to implement CoreSpotlight in my app. When indexing do I need to run this every time or is it sufficient to run this once when app is installed for the first time? If app is deleted do I need to index again? Here's the code I'm using: - (void)spotLightIndexing { NSString *path = [[NSBundle mainBundle] pathForResource: @"aDetailed" ofType:@"plist"]; NSDictionary *plistDict = [[NSDictionary alloc] initWithContentsOfFile:path]; NSArray *plistArray = [plistDict allKeys]; for (id key

CoreSpotlight indexing

荒凉一梦 提交于 2019-12-21 12:50:14
问题 Hi I'm trying to implement CoreSpotlight in my app. When indexing do I need to run this every time or is it sufficient to run this once when app is installed for the first time? If app is deleted do I need to index again? Here's the code I'm using: - (void)spotLightIndexing { NSString *path = [[NSBundle mainBundle] pathForResource: @"aDetailed" ofType:@"plist"]; NSDictionary *plistDict = [[NSDictionary alloc] initWithContentsOfFile:path]; NSArray *plistArray = [plistDict allKeys]; for (id key

Apple-app-site-association not found

Deadly 提交于 2019-12-19 07:39:39
问题 I'm trying to pass the Apple Search Validation Tool, and I'm having problems with the apple-app-site-association. For some reason the bot can't find my file. But if you open the URL it's there. It's not a formatting problem, because the file isn't even found. I have https so it's not needed to sign my file. I don't have any extension on my file, as asked in the documentation. Someone had a similar problem and asked on the Apple Developer foruns, but it didn't help me. My url is https:/

Duplicate search results in spotlight

眉间皱痕 提交于 2019-12-12 03:53:08
问题 I have a requirement where I need to use NSUSerActivity and Corespotlight together. I see duplicate search results in spotlight even after I set relatedUniqueIdentifier =uniqueidentifer. Here is the steps I implemented in my project. 1) Create all CSSearchableItems in appdeleagte didFinishLaunchingWithOptions method. 2) Create NSUSerActivity in specific viewcontroller where relatedUniqueIdentifier = uniqueidentifer(CSSearchableItem) Appreciate your help. 回答1: The issue got resolved after