force Spotlight to index network shares



Today I found a very interesting article on MacOSX hints. It’s about Spotlight and how to force it to index network shares.
By default Spotlight ignores NFS/SMB/AFS shares. Of course there are some problems about the whole metadata idea behind spotlight when it comes to network shares.

It’s the idea behind a network shared volume that makes it hard to be indexed by spotlight. First of all more than one user at a time has access to this volume. So at any time there can be changes made to documents on that volume. Secondly the system Spotlight is running is not informed that a document changed…
One feature of Spotlight is, that you do not have to reindex a drive. It just indexes every document when it’s created or changed on the drive. And this is impossible on network volumes. Because there’s no possibility to stay in touch with the documents like it’s on physically attached exclusive used drives (through the file system for example).

So you have to reindex manually from time to time to use Spotlight on network volumes. So here’s what to do to force Spotlight to index network volumes:

Open a Terminal and enter:

sudo mdutil /Volumes/… -i on

Great hint! Unfortunatly you have to reenable the indexing everytime you mount the drive…that’s once a week for me… so not a big problem but not perfect anyway.

UPDATE: Unfortunately Spotlight just seems to index the network volume but it does not search through this index ;-( Thats disappointing!

Source: MacOSX hints