# Spotlight comments embedded in the file?



## Paul O'Keefe (Jun 3, 2005)

I have a question about spotlight commenting. When you add comments to a file (or multiple files) *do the comments get written directly to the file(s) or does it get written to a database that indexs the comments to the file(s)?*

I ask because I have a huge image libary for work to which I've been adding comments to aid in searchs.

In the future I may have to move this library to a dedicated server so that many users over our provinicial network could access images. Most items are placed in a logically named folder system but I still want users to be able to search via metadata.

Now here is the kicker, It might be served on windows machine or a mac, either way... is it possible for the windows users to read/search the metadata off the mac or for the mac metadata to be translated to a windows server?


----------



## Script Kiddie (Jan 30, 2003)

The file.
All spotlight does is harvest metadata from _files_
That being said, when spotlight searches for things it searches its database, but I assure you the comments you put on your files are indeed in the files.

Actually, you can see this by using the mdimport command like so
mdimport -d2 -n mr-burns.jpg
[... a bunch of kMDItem* stuff is outputted ...]

Now open mr-burns.jpg with the finder and click "get info" and add the comments "script kiddie says so"

repeat the mdimport command and see there is a new kMDItem like so

kMDItemFinderComment = "script kiddie says so."; 

This mdimport command does NOT get stuff out of the database but looks directly at the file, so we have shown that comments (like other metadata) reside in the file.


----------



## Tiranis (Jun 19, 2005)

Nevermind.  (for now...)


----------



## Script Kiddie (Jan 30, 2003)

Here is something very interesting

1) If I copy mr-burns.jpg to mr-burns2.jpg from the terminal (using cp command) mdimport shows it does _not_ have the comments. 
2) if I copy the file to another mac using scp from the terminal and use mdimport to see the comments are not there

However! if I copy mr-burns.jpg using the finder
1) locally 
2) or to smb mounted volume on another mac
Then the metadata _is_ there!

So it looks like the answer to your question is:
It depends how the files are copied from one mac to another.
I'd bet copying to windows will make the metadata disappear.


----------



## madgunde (Mar 10, 2006)

Comments are stored in the invisible .DS_Store file, and may be lost if transferred to filesystems that don't support resource forks (pretty much everything other than HFS/HFS+).

Just did a test. Copied a jpeg to a windows machine over the network, and it appeared normally. Then copied the same jpeg image, which contained comments to the same Windows machine, and the jpeg appears on the Windows machine with an invisible .DS_Store file. If I Get Info on the file on the Windows machine from my Mac, I see the comments. I then deleted the .DS_Store file from my windows machine, and after disconnecting and reconnecting to the Windows PC from my Mac and getting info, the comments were lost.

So basically, as long as the .DS_Store file remains on the non-HFS drive, Mac computers will be able to access the comments, but if the file is renamed or moved in Windows, the link will be broken and the comments lost. If only Mac computers ever manipulate those files, you will probably be OK.

You also have to make sure your backup software backs up the hidden .DS_Store files with the files. The .DS_Store files exist in every single folder where a file might exist which has comments. That file also exists on Mac hard drives as well. Now you know what it is for.

This knowledge-base article will be of interest to you:
http://docs.info.apple.com/article.html?artnum=107822


----------



## Paul O'Keefe (Jun 3, 2005)

So let me see if I understand this:

• comments are NOT stored in the file to which you are adding comments.

• Instead comments are stored in the hidden .DS_Store in the folder the file resides in.

• Also spotlight searches a database for spotlight comments rather than search the files directly for their comments.

• windows systems can not read or search this metadata off a mac volume or server

• windows cannot read/search this metadata when files are copyied onto a windows volume/share/server

• macs can still read the comments from these windows volumes as long as the .DS_Store file is still in their folders

• you can't add comments to files on windows volumes (I'm still not clear on this from the knowledge base because it says you may... eventually)



*Conclusion*
Our massive spotlight-commented photo library can not at the moment be translated to a windows server in a way whereby windows users can search files via this metadata.

*Thanks for your help everyone.* Basically it looks like if we move to some sort of server-hosted image library solution I'll have to get a summer student to do the grunt work of reapplying keywords, comments, or some other form of metadata to the entire library in a way that is searchable to windows users.

Does anyone know anything about Picasa?


----------



## madgunde (Mar 10, 2006)

That's right. File comments are a Mac-only feature and Windows cannot access it in any way (without some sort of third party utility anyway, not sure if any exist).

May I suggest using FileMaker Pro to catalog your photos? There may be other programs that are better suited, but FileMaker Pro would allow you to setup a database very easily which would be accessible via Windows or Mac clients. Of course, this does require each client to have a FileMaker Pro license, but it's a very scalable database system which can grow with your needs. It even allows you to publish databased to a web site, so people could search for images from a web page using FileMaker Pro as the back-end. Searches are very fast too.

Just a suggestion.


----------

