Copy codeThe Code is as follows:
-- 1. enable full-text index of SQL Server for the database
EXEC sp_fulltext_database 'enable'
-- 2. Create a full-text directory
-- (If the error "full-text search not installed or a full-text component cannot be loaded" occurs, the service may not be started or not installed)
EXEC sp_fulltext_catalog 'ask91fable', 'create', 'd: \ Data2005 \ Ask_91_Index'
-- 3. Specify the table for full-text search
-- (The error "... full-text search key must be a unique, non-empty, and single-column index, and this index is not offline ...")
-- (This table must have a unique index [primary key is acceptable],)
EXEC sp_fulltext_table 'ask', 'create', 'ask91fable', 'pk _ Ask '-- unique index name
-- 4. Add columns to the full-text directory
EXEC sp_fulltext_column 'ask', 'subobject', 'add'
EXEC sp_fulltext_column 'ask', 'detail', 'add'
-- 5. Activate the full-text directory
EXEC sp_fulltext_table 'ask', 'activate'
-- Fill
EXEC sp_fulltext_table 'ask', 'start _ full' -- completely filled
-- EXEC sp_fulltext_table 'ask', 'start _ incremental '-- incremental filling
-- Rebuilding (should be fully filled after Reconstruction)
-- EXEC sp_fulltext_catalog 'ask91fable', 'rebuilt'
-- Call (1 million data ,)
-- Select top 1 * FROM Asks
Select id from Asks WHERE Subject LIKE '% NET Summary %' OR Detail LIKE '% NET Summary %' -- 2 minutes 33 seconds
Select id from Asks where contains (Asks. *, 'net summary') -- 0 minutes 40 seconds
Select id from Asks WHERE Subject LIKE '% NET Summary %' -- 0 minutes 42 seconds
Select id from Asks where contains (Asks. Subject, 'net summary') -- 0 minutes 26 seconds