Core Spotlight

RSS for tag

Index your app so users can search the content from Spotlight and Safari using Core Spotlight.

Posts under Core Spotlight tag

23 Posts

Post

Replies

Boosts

Views

Activity

Do we need *both* associateAppEntity and to implement attributeSet when indexing App Entities?
I am working on adding indexing to my App Entities via IndexedEntity. I already, separately index my content via Spotlight. Watching 'What's New in App Intents', this is covered well but I have a question. Do I need to implement both CSSearchableItem's associateAppEntity AND also a custom implementation of attributeSet in my IndexedEntity conformance? It seems duplicative but I can't tell from the video if you're supposed to do both or just one or the other.
1
1
599
Nov ’24
Results with spotlight in Core Data is not all.
I'm using Core Data to save data. Then I wanna add spotlight support. self.spotlightDelegate = StorageSpotlightDelegate(forStoreWith: description, coordinator: container.persistentStoreCoordinator) let isSpotlightDisable = UserDefaults.standard.bool(forKey: "isSpotlightDisable") if !isSpotlightDisable { self.toggleSpotlightIndexing(enable: true) } public func toggleSpotlightIndexing(enable: Bool) { guard let spotlightDelegate = spotlightDelegate else { return } if enable { spotlightDelegate.startSpotlightIndexing() } else { spotlightDelegate.stopSpotlightIndexing() spotlightDelegate.deleteSpotlightIndex { error in if let error = error { print(error) } } } UserDefaults.standard.set(!enable, forKey: "isSpotlightDisable") } It works fine on an iOS15 device, but not work on iOS 17&18. On iOS 18 devices, I can search the data when the first time to added to Core Data. But if I stop spotlight indexing and restart again, the data is never be searched. How can I to solve this? And I noticed that the problem is also exists in another dictionary app.
0
0
460
Nov ’24
Is semantic search working with CSUserQuery?
I'm following the video tutorial below, using the exact examples, but was not able to semantically match the results: https://developer.apple.com/videos/play/wwdc2024/10131 https://developer.apple.com/documentation/corespotlight/building-a-search-interface-for-your-app In iOS 18 and macOS 15 and later, Spotlight also supports semantic searches of your content, in addition to lexical matching of a search term. I'm on macOS 15.1, so I'd expect it should work now? Or is this depend on Apple Intelligence for some reason? Specifically I've indexed the following: Keyword: "windsurfing carmel" Literal match: the best windsurfing carmel county windsurfing lessons Semantic match: sailboarding lessons the best windsurfing carmel county windsurfing lessons Expected: find semantic match. Actual: only literal match were returned. Because CSUserQuery.prepare is only supported by macOS 15, my switch from CSSearchQuery makes no sense without the semantic search benefits. Did I miss something? I also added the corespotlight delegate extension as directed but was not able to hit the breakpoint as per the video. I wish there is the sample code for this, but couldn't find it.
1
2
817
Oct ’24