Question

I've followed the instructions to integrate spotlight into a non-document based Core Data application using Record-Level Indexing. The spotlight importer imports the files correctly and those records can be found using mdfind "some string".

The problem is the spotlight user interface – the magnifying glass in the top right – doesn't show these records when running inside the sandbox.

The external record files are created in ~/Library/Containers/[my app]/Data/Library/Caches/Metadata/CoreData/[my app]

Am I doing something wrong?

Was it helpful?

Solution

Comparing the results of mdimport -d2 [external record file] showed this extra property:

kMDItemSupportFileType =     (
    MDSystemFile
);

Adjusting the spotlight importer to remove this key seems to fix it. The results are now shown in the spotlight UI. I'm guessing it hides system files from the results.

[spotlightData removeObjectForKey:@"kMDItemSupportFileType"];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top