在未做全文检索以前,个人主页只能对Fs_Title(文章标题)字段进行模糊查询(like '%*%'),如果对内容进行模糊查询,速度极慢,有时还可能报错,今天终于有空了,把这个查询做好了,经过测
试,检索一万条纪录不到两秒时间。ENJOY~~
复制代码代码如下:
use LuanLuanDB
exec sp_fulltext_database 'enable'
exec sp_fulltext_catalog 'ArtileFullText', 'create', 'E:\SearchPage'
exec sp_fulltext_table 'TArticle', 'create', 'ArtileFullText', 'PK_TArticle'
exec sp_fulltext_column 'TArticle', 'Fs_Title', 'add'
exec sp_fulltext_column 'TArticle', 'Fs_Content', 'add'
exec sp_fulltext_table 'TArticle', 'start_full'
测试代码:select * from TArticle where Contains(*,'"&key&"') and Fi_IsShow='1' order by Fi_ID DESC