Full-text Indexes

Full-text support for Microsoft® SQL Server™ version 7.0 data involves two features: the ability to issue queries against character data, and the creation and maintenance of the underlying indexes that facilitate these queries. Full-text indexes and the tasks involved in creating and maintaining them are described here.

Full-text indexes differ from regular SQL indexes in a number of ways.

Regular SQL indexes Full-text indexes
Stored under the control of the database in which they are defined. Stored in the file system, but administered through the database.
Several regular indexes per table allowed. Only one full-text index per table allowed.
Automatically updated when the data upon which they are based is inserted, updated, or deleted. Addition of data to full-text indexes, called population, must be requested through either a schedule or a specific request.
Not grouped. Grouped within the same database into a full-text catalog.
Created and dropped using Transact-SQL statements. Created, managed, and dropped using stored procedures.

These differences make a number of administrative tasks necessary. Full-text administration is carried out at several levels:

At all these levels, facilities are available to retrieve metadata and status information.

Unlike regular SQL indexes, full-text indexes are not automatically kept up-to-date as data is modified in the associated tables. Tables that can be updated should have their full-text indexes repopulated at appropriate intervals. This repopulation can be time-consuming and resource intensive; therefore, it is an asynchronous process that is usually run in the background during periods of low database activity. Tables with the same update characteristics (such as small number of changes versus large number of changes; or tables that change frequently during a particular time of day) should be grouped together and assigned to the same full-text catalog. This allows full-text catalog population schedules to be set up in a manner that will allow the full-text indexes to stay synchronous with the tables without adversely affecting the resource usage of the database server during periods of high database activity.

It is important to plan the placement of full-text indexes for tables in full-text catalogs. When you assign a table to a full-text catalog, consider the following guidelines:

There are two ways to administer full-text features: through a set of stored procedures and scalar functions, and through SQL Server Enterprise Manager.

The first method, through stored procedures and scalar functions, is described in the following topics: Scenario A: Enabling Others to Issue Full-text Queries; Scenario B: Performing Investigation and Clean-up Tasks for Full-text Catalogs; and Scenario C: Performing Infrequent Tasks. These scenarios assume that the writers and books tables have been added to the pubs database.

The writers table illustrates the columns that are candidates for full-text indexing, specifically the varchar data type.

Column name Data type Enable full-text features?
writer_name char(40) No
citizenship char(40) No
organization varchar(100) Yes
royalties_ytd decimal(7,2) No
royalyties_lifetime decimal(7,2) No
bio varchar(500) Yes
writer_id integer 
(with a unique value enforced by the writer_id_index index)
No
last_changed timestamp No

The books table illustrates the columns that are candidates for full-text indexing, specifically the varchar and text data types.

Column name Data type Enable full-text features?
writer_name char(40) No
title varchar(120) Yes
size smallinit No
pub_date datetime No
the_words text Yes
abstract varchar(500) Yes
isbn char(15) (with a unique value enforced by the isbn_index index) No
last_changed timestamp No

For more information about both querying and indexing, see Example of Combining Full-text Administration and Full-text Query.

The second method of administering full-text indexes is through the Full-text Indexing Wizard and context menus in SQL Server Enterprise Manager. Tasks for both methods follow.

To enable a database for full-text indexing

    

To enable a table for full-text indexing

    

To enable a column for full-text indexing

    

To edit a full-text index on a table

    

To remove a full-text index from a table

    

To create a full-text catalog

    

To rebuild a full-text catalog

    

To rebuild all full-text catalogs in a database

    

To start and stop a full or incremental population of a full-text index

    

To check the status, tables, and schedules of a full-text catalog

To change or create a new schedule of a full-text catalog

To remove a full-text catalog from a database

    

To remove all full-text catalogs from a database

    

To clean up a full-text catalog on a server

    

To repopulate all full-text catalogs for a database

    

  


(c) 1988-98 Microsoft Corporation. All Rights Reserved.