Skip to content

Spotlight

Ken Harris edited this page Jul 28, 2020 · 2 revisions

"Spotlight" is a brand name that refers to a couple of different technologies, which you interact with in some very different ways.

  • Spotlight "classic" is for documents (i.e., files)

    • To index files, you used to need to write a CFPlugin using a special project template, but haven't shipped this in Xcode since Xcode 8 (2016), and it calls deprecated functions, so (TBD!)

    • To search files, use NSMetadataQuery. It's quirky but it mostly works.

  • Core Spotlight is for making parts of your application (not documents) searchable, for up to "a few thousand items", and the index is per-user. I think it appeared on iOS first, but either way, it's definitely an iOS-style search platform.

    • There's a fairly recent CoreSpotlight.framework with ObjC/Swift interfaces for interacting with this.
Clone this wiki locally