I'd like to determine how to programatically start/stop/pause the indexer from Microsoft Search.
I know it is possible because I've seen it done in programs like this one: http://brandontools.com/files/folders/sidebar_gadgets/entry511.aspx
However, I cannot find any docs on MSDN or anywhere.
There is a "Windows Search" service which can be controlled with traditional service control methods. However, starting/stopping this service also changes the availability of search itself. I want to control just the indexer.
Does anyone know where docs may be found that describe how to interact with the indexer? My search skills have failed me.
There isn't a way to simply disable the indexing part. It's an all or nothing service. The description of the WSearch service states:
"Provides content indexing and property caching for file, email and other content (via extensibility APIs). The service responds to file and email notifications to index modified content. If the service is stopped or disabled, the Explorer will not be able to display virtual folder views of items, and search in the Explorer will fall back to item-by-item slow search."
However, you might be able to control it through drive/folder properties ... from Explorer, you can switch it of for an individual drive (see the properties of a drive; there's an option "allow indexing service..."), or for a folder (folder properties -> advanced -> "For fast searching, allow indexing service...").
EDIT ... a bit of googling, and the above properties are available - if you look at the MSDN page for System.IO.FileAttributes, there's a property NotContentIndexed
with the description The file will not be indexed by the operating system's content indexing service. I would assume that you should be able to set this on individual folders. I don't know if this works if set at the drive level (without a recursive run through the drive), but hopefully it'll give you a head-start on whatever you're ultimately trying to achieve.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With