I'm trying to understand how Spotlight indexing works - in the documentation here, Apple says that the kernel notifies the Spotlight engine which then attempts to update the metadata store. If this is the case, why does it have to index - presumably it would be up to date if this already happens after every file event?
1 Answer
Initially, the indexers have to process the entire disk so there are hours (days) to take one pass to index all files.
Steady, state the kernel and system indexes all files as they are written so newly created files and files copied in are basically indexed real time.
You can see this in action by having spotlight in finder search a nonsense string that doesn’t exist. Then open text edit and past that string into a file and save it to your desktop - watching the finder window update to show that file.
-
Is this a synchronous thing - kernel updates the system store before returning control to the calling program that wrote the file? Or some more asynchronous thing where it enqueues the changes to be made and Spotlight daemon picks it up?– AndrewApr 15, 2018 at 16:32