Spotlight importer: how to hide the actual file name?

169 views Asked by At

I have a Mac shoebox app with a custom data format. I'd like to add Spotlight support.

From what I read, the recommendation seems to be to define a custom UTI file type and create one file of that type for each "record" in my app as a reference to the actual "record" that my app can then make sense of when the user clicks on a search result.

So far so good. My custom Spotlight importer works and indexes my "reference" files. They show up in Spotlight.

However, the file name reveals that this is my custom "reference" file. From a user's perspective that does not make sense.

Is there a way to hide or replace what is shown as file name and path in Spotlight?

Also, if a users presses Command while clicking on the search result, the file is revealed in Finder. In my case in the Library/Caches/Metadata/MyApp folder. That's not what I want… I don't want users to see this folder, because it reveals internals about the app.

Spotlight result

EDIT: In a way, my app is similar to a Core Data app with a database, only that I'm using a custom data format. With Core Data, the user also does not see the actual database file.

1

There are 1 answers

3
Pierre Bernard On

Try providing a value for kMDItemDisplayName