I've been trying to add a CoreSpotlight indexer to my macOS application. The new template for the indexer uses the new appex CSImportExtension
style importer.
I've been following this ->
https://developer.apple.com/documentation/corespotlight/csimportextension
- I changed the
CSSupportedContentTypes
in the Info.plist file to the correct file type uti. - I added a dummy value into the attributes (see code below) - just setting
contentDescription
to 'noodle' (easy to search for)
class ImportExtension: CSImportExtension {
override func update(_ attributes: CSSearchableItemAttributeSet, forFileAt: URL) throws {
// Add a dummy value, and see whether spotlight finds it
attributes.contentDescription = "noodle"
}
}
- I have a number of files on disk that match the uti (and can be found when I search by the file name)
Yet, when I build and run my app, the a spotlight search for 'noodle' finds no results.
Can anyone give me any advice? I cannot find any indication that the ImportExtension is called (although when I put a log message at the start of the update()
call there's no message in the console which seems to suggest it's not being called).
Is there any way of debugging this?
Cheers and thanks -- Darren.