Core Spotlight does not work on macOS.

Hi, guys.

I have an issue with Core Spotlight on macOS. I've tried sample app (Pictures from WWDC Core Spotlight topic) and it does not work (10.13 beta 3, XCode 9 beta 3). The app is running but no search results appear in Spotlight. Same issue with Quick Look preview (no results). Seems like indexing is not working.

Thanks in advance.

Replies

I don't happen to have this sample handy, but if it's not working please file a bug report and attach your version of the sample so we can have a look. It's entirely possible that something in the SDK shifted to render the sample non-functional.

I'm also having this exact same problem. I'll file a bug report and keep a watch on this thread, thanks

Please post your bug number so I can follow up with the engineering team.

Just filed the bug, its ID is 33741368. Thanks!

I'm also having the same problem. I can find Spotlight items by type but not by anything else. When I dump attributes on a match there are no interesting fields in it. For example, here's a match for kMDItemContentType = com.apple.ichat.transcript :


(lldb) po [item attributes]

<__NSArrayM 0x604000245be0>(

kMDItemContentTypeTree,

kMDItemSupportFileType,

kMDItemContentType,

_kMDItemOwnerUserID,

kMDItemPhysicalSize,

kMDItemDisplayName,

kMDItemKind,

kMDItemContentCreationDate,

kMDItemContentModificationDate,

kMDItemDateAdded,

kMDItemLogicalSize,

kMDItemDateAdded_Ranking,

kMDItemInterestingDate_Ranking,

kMDItemContentCreationDate_Ranking,

kMDItemFSName,

kMDItemFSSize,

kMDItemFSCreationDate,

kMDItemFSContentChangeDate,

kMDItemFSOwnerUserID,

kMDItemFSOwnerGroupID,

kMDItemFSNodeCount,

kMDItemFSInvisible,

kMDItemFSTypeCode,

kMDItemFSCreatorCode,

kMDItemFSFinderFlags,

kMDItemFSHasCustomIcon,

kMDItemFSIsExtensionHidden,

kMDItemFSIsStationery,

kMDItemFSLabel

)


Note that kMDItemAuthors, kMDItemInstantMessageAddresses, kMDItemDescription are missing.


If I do an mdls on the correspond file I see all the metadata. Is some kind of provisioning profile or entitlement now required for Spotlight queries?

radar 33759748

Can I ask, do you have a link to the sample code for "Pictures from WWDC Core Spotlight" ?

This is the link but for me Spotlight does not work, I am doing the indexing correctly but it does not work.


https://developer.apple.com/sample-code/wwdc/2017/Core-Spotlight-Drag-and-Drop.zip

Copy and paste the link because the redirection is not working.

The "Core Spotlight Drag and Drop" example does not work either in the latest beta of macOS 10.13.1


Some other observations:


I think this is just unfinished work from Apple. Every developer that like to use this API in macOS, which works perfectly in iOS, should make a bug report.


The WWDC 2017 "Core Spotlight Drag and Drop" example code is part of the demo on Core Spotlight:

https://developer.apple.com/videos/play/wwdc2017/231/

Just refer to this example project when making a bug report.

Every developer that like to use this API in macOS, which works perfectly in iOS, should make a bug report.

Indeed. Can you post your bug numbers, just for the record?

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Sure thing: 34951687

I haven't opened a bug yet, because I opened a DTS (number: 674214446). The DTS engineer is still working on a solution.

34230938, for some reason it got closed with no details but I've asked them to reopen.

I could make it work by removing com.apple.application-identifier key from Pictures.entitlements file. The com.apple.application-identifier value was different to the bundle id of the app, which seems to be the reason why the spotlight items does not show up on the spotlight search lists.

the issue is still reproducible on macOS 12.0.1. Any help is appreciated!