Setting Up Full Text Search: A Step-by-step GuideOctober 26, 2002
This document was developed against Microsoft SQL Server 7.0,
but full-text search can work in SQL Server 2000 as well;
SQL Server 2000 also has some full-text search enhancements not found in SQL Server 7.0 that are identified and explained in a separate section below.
The full-text search runs as a service named Microsoft Search
Service (MSSearch service).
To work with full-text search, you should have the following
operation systems:
The MSSearch service cannot be installed on Windows 9x,
Windows NT Workstation, or Windows 2000 Professional clients, but
these clients can use full-text search when the MSSearch service
has been installed on the server machine.
Full-text search is supported under the following SQL Server editions:
To install full-text search in SQL Server 7.0 you should choose the
Custom installation type, as full-text search is not included
under the Typical or Minimum installation types.
To install full-text search in SQL Server 2000 you should choose
Typical or Custom installation types, as full-text search
is not supported under the Minimum installation type.
Because working with full-text search is extremely resource intensive,
you should have plenty of physical and virtual memory. Set the virtual
memory size to at least 3 times the physical memory installed in the
computer, and set the SQL Server max server memory server
configuration option to half the virtual memory size setting
(1.5 times the physical memory).
The full-text indexes are very different from the regular SQL Server
indexes. The full-text indexes are stored in the full-text catalogs
outside of SQL Server databases and are managed by the MSSearch service.
A full-text catalog is a set of operation system files (the default
directory determined during installation is Ftdata subdirectory
in the Microsoft SQL Server directory; for example, C:\MSSQL7\Ftdata,
the default directory for SQL Server 7.0; and
C:\Program Files\Microsoft SQL Server\Mssql\Ftdata, the default
directory for SQL Server 2000).
Unlike regular SQL indexes, only one full-text index per table
is allowed. 249 nonclustered and 1 clustered regular SQL indexes
are allowed per table.
Unlike regular SQL indexes, full-text indexes are not updated
automatically when the data upon which they are based is inserted,
updated, or deleted. To reflect these changes, you should update
full-text indexes manually, or create a job to update these indexes
on a scheduled basis.
Unlike regular SQL indexes, full-text indexes cannot be directly created,
managed, or dropped using Transact-SQL statements, only by
using SQL Server Enterprise Manager, wizards, or stored procedures (see
Eli Leiba's article
"Implementing Full Text Search with T-SQL Stored Procedures" for more information
on using FTS and T-SQL together). For example, DROP INDEX and CREATE INDEX statements are not
allowed for full-text indexes.
There are two ways under SQL Server 7.0 to synchronize full-text
indexes with their table data:
Incremental Population - A population which only adjusts index
entries for rows that have been added, deleted, or modified after
the last population. To use Incremental Population the indexed table
must have a column of the timestamp data type. If the indexed table
does not have a timestamp column, only full population can be used.
The population of full-text indexes can be made either through
Enterprise Manager or through the sp_fulltext_catalog system
stored procedure.
Because full-text index population can take time, these populations
should be scheduled during CPU idle time and slow production periods,
such as in the evenings or on weekends.
With the On demand option, you should manually update the full-text
index by using the sp_fulltext_table with the update_index for the
@action parameter.
With the Scheduled option, you can use SQLServerAgent to schedule
periodic jobs that execute the sp_fulltext_table system stored
procedure with the update_index for the @action parameter.
This is the example to start the Change tracking with the Background
option for the Product table in the Sales database:
Note: Change tracking does not track any WRITETEXT or UPDATETEXT
operations.
Another SQL Server 2000 full-text search enhancement is image
filtering. Image filtering allows you to index and query documents
stored in image columns (only the text data stored in image columns
can be indexed; images or pictures cannot be indexed).
Note: Though a single computer can have multiple instances of
SQL Server 2000, only one MSSearch service can exist. So, a
single MSSearch service manages the full-text indexes for all
the instances of SQL Server 2000 on the computer.
In this example, I will create a full text index for the pr_info
column from the pub_info table in the pubs database. Because using
the GUI interface is a much easier and intuitive way to set up
full-text search compared with using system stored procedures,
I will illustrate setting up full-text search using the
SQL Server Enterprise Manager.
First, run SQL Server Enterprise Manager, expand a server group and expand
a server. Expand Databases and click a database to enable. On the
Tools menu, click Full-Text Indexing as shown in Figure 1.
Figure 1
Figure 2
Figure 3
Figure 4
Figure 5
Figure 6
Figure 7
Figure 8
Figure 9
Figure 10
Figure 11
Figure 12
Figure 13
Figure 14
Literature1. Full-Text Indexes2. Full-Text Indexing Support 3. Full-Text Query Architecture 4. Maintaining Full-Text Indexes 5. Implementation of Full-text Search
|