Create catalogs of file-system information

Organizations face a problem: To avoid losing precious time and resources, employees need to locate documents quickly and accurately. Given the wide use of Microsoft Office, Web documents, email systems, and other information systems, having an effective means to access and track documents in various systems is vital. To address this need in Windows NT, Microsoft introduced Index Server. The most recent NT release, Index Server 2.0, ships with the NT 4.0 Option Pack. Microsoft renamed the newest version of this tool Indexing Service 3.0, which comes as part of Windows 2000.

Understanding how Indexing Service works is easy. After you install Indexing Service, it searches the system and builds catalogs that contain an index of file-system items and their property information. The program runs periodically to update the catalogs. Each time a user performs a search in the catalogs, the search uses the index.

By default, Indexing Service creates the System catalog, which contains an index of all files, except for temporary Internet and history files, on the local drives. If Microsoft IIS is running on the system, Indexing Service also creates a Web catalog and indexes the folders that Table 1, page 108, shows.

Microsoft recommends that you turn off virus scanning when you run Indexing Service. Therefore, you might want to use a virus scanner that you can schedule to shut down when the indexing process starts.

Indexing Service uses filter components to read and process information from files and other systems. Win2K's Indexing Service includes filters for MIME messages and Microsoft Office, HTML, and plaintext files. You can also develop and install custom filters.

For information about installing Index Server, see T.J. Harty, "Microsoft's Index Server," January 1997. During Win2K installation, Indexing Service automatically installs (the OS has the Indexing Service check box selected by default). To manage the service, you use the Computer Management tool or the Indexing Service Microsoft Management Console (MMC) snap-in. To start Indexing Service, go to Start, Programs, Administrative Tools, and select Computer Management from the menu. From the Services and Applications folder, right-click the Indexing Service subfolder and select Start. After the service starts, it will scan your system and prepare the default catalogs. This process can take several minutes because the service scans and reads the files. You'll notice the hard disk or disks on your system churning during this process.

After the indexing process completes, users can use one of several interfaces and methods to search for items. When possible, the Windows Start menu's Search function will query the index catalogs to obtain a result. Users can also use a Web form or a custom application to perform queries. A developer merely needs to add a query for an application that can search Indexing Service. To submit queries, administrators can use the MMC snap-in's Query the Catalog page for each index in the Indexing Service folder. Custom applications can specify the catalog to query.

Creating Catalogs
You can also use the Indexing Service MMC snap-in to create catalogs. Custom catalogs are useful when you want to create an index that represents either a subset or superset of files or data. For example, imagine you need to publish a catalog of all your organization's engineering documents that relate to development. You can create a new catalog and configure it to index only the directories that have development-related documents.

When creating a catalog, you need to name the catalog and select a folder in which to store it. You can store the folder on any local drive. Use an explicit name for this folder to avoid confusion about its contents or purpose. Figure 1 shows the IndexingServiceCatalogs folder, which I use to store catalogs.

To create a catalog, right-click Computer Management's Indexing Service folder, select New Catalog, type the name for the catalog, select the folder for the catalog, then stop and restart the service. The last step is necessary because the program adds the catalog only after the service stops and restarts.

After you create a catalog, you can add the directories or other items that a user will search. You can dynamically add the catalog directories while the service is running. To add a directory to a catalog, right-click the catalog folder and select New, Directory from the shortcut menu. Then, fill in the path to the directory or enter the Uniform Naming Convention (UNC) name and click OK. You need to enter a username and password only when the directory you're accessing requires authorization. Indexing Service respects and uses the Win2K security system; therefore, the service won't list in its results files that users don't have permission to access.

After you add a directory, Indexing Service indexes it. NTFS uses an Update Sequence Number Changed attribute on files, which lets the service check only modified files.

You can also index Web files. To set up a Web index, right-click the catalog to which you want to add the Web index and select Properties. From the Properties dialog box, select the Tracking tab, then from the WWW Server drop-down list, select the Web server that you want to index. Figure 2 shows the Default Web Site server selected as the WWW Server. After you select the Web server, click OK and stop and restart Indexing Service. Then, the service will pull the entries from the Web site, as Figure 3 shows. You can see that the KensDocs catalog contains the My Documents folder, and the service pulls all the virtual directories from the Default Web Site server. Don't place the catalog for the Web server in a Web root or virtual directory because IIS can lock the catalog and prevent updates.

You can also use the service to generate document abstracts. If you've performed a search at http://www.microsoft.com, you've seen the result of abstract generation. Each document in the results list contains a short abstract. To force Indexing Service to generate abstracts for you, open the catalog's Properties dialog box, select the Generation tab, then select the Generate Abstracts option. The default maximum size for an abstract is 320 characters. You can change this number in the Maximum size box on the Generation tab. By default, each catalog will inherit its properties from the Indexing Service properties. To set the properties for a particular catalog, clear the Inherit above settings from Service check box on the Generation tab.

You can also use the Indexing Service MMC snap-in to delete catalogs. To delete a catalog, stop Indexing Service, select the catalog to delete, press the Delete key, and restart the program.

You can also search a catalog in the MMC. Open the Query the Catalog page, and enter your query. This feature makes testing and looking for items in a catalog a snap when you're maintaining a catalog. If you try to query a catalog before you start Indexing Service, you'll receive the error message Service is not running.

Index Files
One key but overlooked aspect of using an index service is the file properties that the service indexes. To index an Office document, Indexing Service reads the file's properties, but for the service to read the properties correctly, the file's creator or maintainer must have filled them in. To add properties for an Office file, you can use the File menu Properties dialog box. To automatically display the dialog box when a user saves a new file, select Microsoft Word's Tools menu, then select Options, the Save tab, and the Prompt for document properties check box. The location of this option varies throughout the Office applications.

For Web files, file developers need to supply the proper meta tags so that the service can properly pick up the data. Indexing Service uses several meta tags, which Table 2 shows, that map to properties. You can search the Web for the term meta tag to find numerous sites that provide information about HTML meta tags.

Developer Applications
Software developers can write applications that work with the Indexing Service in a variety of ways. Developers can write filter applications, but they can also create applications that use the service's query features. These applications provide an easy-to-use interface with which users can search directly from the application.

The Microsoft Developer Network (MSDN) provides information about application development for Indexing Service. The Programming for Indexing Service chapter of MSDN's online book Platform SDK shows how to perform Indexing Service tasks in different programming languages.

Indexing Service is a useful tool that provides access to different types of documents. The service's integration ability lets you incorporate the search features into any application. Microsoft also made the Win2K service easy to use by including it in the installation and integrating it into the search function and file system.