Can I change name displayed in Spotlight search results?
I am writing a Spotlight importer for an application that stores content in files with meaningless names. There is benefit from allowing the user to search for these files, however.
It's easy enough to write an importer that extracts and ret开发者_JAVA百科urns useful metadata but when the user does a search in Spotlight they are presented with the meaningless file names.
I'd like to be able to change the string returned in a Spotlight search. For example, if the search returns file "abc123.qrt" I'd like it to display as "useful name for result". Is there a way to do this? Ideally there would be an appropriate piece of metadata that Spotlight (or Finder) would respect.
-Andy
After a bit of digging turns out that 'kMDItemDisplayName' does the trick. It wasn't immediately working for me but did once I managed to re-import the file
精彩评论