Use the full-text index in SQL Server

xiaoxiao2021-03-06  53

Author: David Euler.

Date: 2004/09/11

Email: DE_EULER-DAVID@yahoo.com.cn

if you have any problem, please contact me:)

Generally, using the full-text index in SQL Server, through the general four steps:

1). Install the full-text index service of Full Text Search;

2). Establish Full Text Catalog Full Text Index Directory for Data Sheet;

3). Perform Full Text Catalog's Population (Synchronize full-text index with data sheet content);

4) Use full-text index to enter the line.

In order to update the content update in the data table, the content of the full-text index database is also up to date, and the Population of Full Text Catalog can be established in step 5.

1.SQL Server The default is not installed with the Full Text Search Service, and you can use it when you need to install it. If the Full Text Search Service is installed, in SQL Server Enterprise Manager, the database is expanded, there will be a full text catalogs; select a database, "New" in "New" in the Right-click menu, there is a New Full Text Catalog. And Check any of the tables, right-click, there will be a Full-Text INDEX TABLE (full text index table) menu to use. If the Full Text Search Service is not installed, then this menu is gray.

2. Establish Full Text Catalog to the table. Suppose there is a table mybbs in the database CoreDB. This table is stored in a forum all posts, title (directhor), content (content). We selected table mybbs, right-click, new full text catalog, select Content as a full-text index, create a new Full Text Catalog, name Content.

3. At this time, only Full Text Catalog does not use full-text index. Need to make the content in the full-text directory consistent with the contents of the database index table, this step is implemented by Full Population or Incremental Population: Enterprise Manager Expand Database CoreDB, double-click Full-Text Catalog, you will see a CONTENT Full-text directory, select right-click, click Start Full Population or Start Incremental Population, you can use indexing function.

4. Use index function:

Select * from mybbs where contains (content, '"windows");

This statement queries records that contain Windows strings in the full-text index content of mybbs table.

5. When the index table in the database is updated, the Population synchronization is required, and the content of the full text query is the content in the new data table. So we can set the SQL Server automatic Population operation: Right-click Full Text Catalog, Schedules, New Catalog Schedules, Enter Name, select the enabled option, and set the execution frequency of the planned task, you can set SQL Server each time When Agent is started, you can also set it once, or set it repeatedly, repeated execution, can set the execution frequency is month, week, day, you can set it once a day. (So ​​as long as the SQL Server Agent is launched, the Population Synchronization Plan will be automatically executed) Summary, by installing the full-text index service, establish a full-text index directory of the data table, and synchronize the full-text index query after synchronizing the full-text index database. You can synchronize the index database from the automatic Population Schedule of Full Text Catalog.

Reference: SQL Server comes with the help document "SQL Server Books Online".

Full-text Catalogs and Indexes

Full-text indexes

Full-Text Search

Microsoft Search Service

Full-text Querying Support

转载请注明原文地址:https://www.9cbs.com/read-118035.html

New Post(0)