全文检索技术 sql server
时间:2021-02-27 14:33:34|栏目:MsSql|点击: 次
在未做全文检索以前,个人主页只能对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
上一篇:SQL语句实现SQL Server 2000及Sql Server 2005日志收缩(批量)
栏 目:MsSql
下一篇:table 行转列的sql详解
本文标题:全文检索技术 sql server
本文地址:http://www.codeinn.net/misctech/71069.html