Home >Database >Mysql Tutorial >全文检索技术 sql server

全文检索技术 sql server

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-07 17:56:521024browse

全文检索技术 sql server

在未做全文检索以前,个人主页只能对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
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn