Introduction
If you work with Indexing Service (CISVC) in Microsoft Windows 2000, you might be interested in having a periodic report emailed to you from the server.
At a previous job, I made extensive use of Indexing Service (CISVC) for keyword searching in the database. You might wonder why I didn't just use the SQL Full Text Indexing.. we did, but found the performance and controlling the process not adequate.
Details
The key component used to access the indexing service is:
AdminIndexServer
(ProgID: Microsoft.ISAdm
)
This component provides access to a number of objects and methods that are used to query the status of the indexing service and its catalogs.
Objects, methods and properties used:
AdminIndexServer
(ProgID: Microsoft.ISAdm
)
GetCatalogByName
(returns CatAdm
object)
CatAdm
CatalogName
(gets the current catalog name)
IsUpToDate
IsCatalogRunning
IsCatalogPaused
IsCatalogStopped
IndexSize
TotalDocumentCount
DocumentsToFilter
PctMergeComplete
QueryCount
StateInfo (* bitwise lookup, below)
I've chosen to only report on the status of specific index catalogs, but you can loop through all of the index catalogs by using the methods FindFirstCatalog
and FindNextCatalog
.
Note that the status of the catalog is given in such a way that you can use bitwise operations to get multiple statuses from the one return value. Here's a list of the constants I've used to get the status of the indexing service catalog:
CI_STATE_SHADOW_MERGE = 1 '0x1
CI_STATE_MASTER_MERGE = 2 '0x2
CI_STATE_CONTENT_SCAN_REQUIRED = 4 '0x4
CI_STATE_ANNEALING_MERGE = 8 '0x8
CI_STATE_RECOVERING = 32 '0x20
CI_STATE_INDEX_MIGRATION_MERGE = 64 '0x40
CI_STATE_LOW_MEMORY = 128 '0x80
CI_STATE_HIGH_IO = 256 '0x100
CI_STATE_MASTER_MERGE_PAUSED = 512 '0x200
CI_STATE_READ_ONLY = 1024 '0x400
CI_STATE_BATTERY_POWER = 2048 '0x800
CI_STATE_USER_ACTIVE = 4096 '0x1000
CI_STATE_STARTING = 8192 '0x2000
CI_STATE_READING_USNS = 16384 '0x4000
I hope this is useful for anyone having to deal with indexing service. I had many painful hours as I dealt with some quirk.
I think it's fairly straight forward to understand, I've tried to keep it simple (I'm sure someone has a witty quip to insert here... something about being simple ;-)).
History
- 19th June, 2006: Initial post