全文检索技术 sql server
(编辑:jimmy 日期: 2024/11/25 浏览:3 次 )
在未做全文检索以前,个人主页只能对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
试,检索一万条纪录不到两秒时间。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
下一篇:整理一下SQLSERVER的排序规则