🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: cn.bbs.comp.database
Article #576

SQL Server 2008 Full-Text Search Overview

#576
From: Galaxy��VOLUNTEERS��Database
Date: Fri, 13 Feb 2009 08:17
113 lines
7722 bytes
��ǰ����Full-Text Search��ȫ�ļ��������Ǻ����⣬��Ϊ������ͦ��Enableһ�¾�
�����ˡ�����������һ����ص�newsgroup case��������featureҲ������ô�򵥵ģ���
���в������߰���ĺ������ISABOUT��weight��CONTAINS�ȡ�֮ǰ��������һ��Ҳ��
��ȫ�ļ�����email case��˵2000��05���ֶ�TEXT��ȫ�ļ��������ã��Ҳ���һ
��û���⣬ֻ�õȿͻ�repro֮��Ľ���ˣ���ȻMSDN��д���ƺ���ֻ��charϵ�У�Ҳ��
��nvarchar��varchar��char��nchar֮��Ŀ��ã�������һ��link��Ҳ����TEXT���
���ͣ���ì�ܡ�������

1. ����
�����˽����ţ�
Q��ΪʲôҪFull-text search��ȫ�ļ�������
A����Ϊ�����ֵIJ�ѯ�ٶ�������������Ͻ�����Ҳ����������?
Q����2005�����ô��
A����Ȼ���������ǰ�����˸�integrated�ˡ���ǰ05���е����������ļ������棬08
�м��ɵ�filegroup��ȥ�ˡ�
Q��ʲôԭ�?
A�����ڹؼ��֣�keyword��
Q������ͨ����Ĺ�ϵ��
A��Ŀ�Ķ�����߲�ѯ�ٶȡ�ȫ�����������Ժ�Index������һ��
   ������һ�䣬ͻȻ�뵽��ħ������Ŀ¼������loli�������
   ȫ�ļ���ʹ��������������⼼������ȥ�ͺܸ���ô�����������ڶ������ļ���
Q����ɶ�ã�
A���ٸ���򵥵����ӣ������ģ�ģ��ƥ�䣬���ٴ���������rank��

2. �ܹ�
05�ļܹ��μ�http://i.technet.microsoft.com/Cc721269.SQL2008FTSFig01(en-us,SQL
.100).jpg
���Ϊ��飺MSFTEFD.EXE, MSFTESQL.EXE, SQL SQLSERVER.EXE
08�Ľṹ�μ�http://i.technet.microsoft.com/Cc721269.SQL2008FTSFig02(en-us,SQL
.100).jpg
���Ϊ���飺sqlservr.exe��fdhost.exe���������һ��Filter Daemon Launcher 
Service(MSSQLFDLauncher)����fdhost������������

3. �����ڰ汾��08
һ���Ҳ�̫��ע��飬����οͻ�������ͳ��������ֻ�ܺúÿ��ˡ�����
��Ϊ�����ݣ�һ����08���������⣬������Full-Text Catalogs��ȫ��Ŀ¼��
��������in-place upgrade��detach��attach��backup��restore��Copy Database 
Wizard���Ӳ��ˡ�
�����
a. Use full population (rebuild)
˵���˾��ǿ�����������Ȼ��ʱ����Դ���ⲻ�˵ġ�
b. Import the indexed data (default option)
�������ʡʱ��
c. Reset the full-text catalogs
�����趨������������֮�䡣
��Ϊ05��08�������б仯����whitepaper����˼�����Ƽ�repopulate��

4. Filter Daemon ���
����ΪʲôҪ�����fdhost����Ϊ�˱���SQL Server��̡�����Ҳ���������case�п�
����fdhost�����������ǧ�Ρ�����
Ϊ�˰�ȫ���ǽ���ʹ�ý�Ϊ��Ȩ�޵��ʺ���run��
��exec sp_fulltext_service ��restart_all_fdhosts��ȡ���κ��������еĻ����
������fdhost.exe��

5. �﷨�ϵĸĽ�
ȫ�ļ����﷨
1.contains:��ȷ��ƥ��
where contains(*,' "my name is" ') --�Զ���ľ�ȷƥ��,ע��Ҫ��˫���
where contains(*,' "my" or "name is" ') --���ߵĹ�ϵ
����'and not'  'and'   
�����ٽ�ʺ�Ȩ��

2.freetext:ģ��ƥ��(������swim����ƥ���swam)��contains�﷨��ͬ

3.containstable
�˺����һ����
�˱��������
һ����key(����������)  һ����rank(���ص�������������ƥ��̶�,Խ��Խ��ȷ)
select  title from mytable p 
join containstable(mytable, title , 'xland') ct
on p.id  = ct.[key] 

4.freetexttable��containstable����

5. ������stoplist��Ҳ�����������б?������ε�caseû��ϵ���Թ�

6. Troubleshooting
������Ϣ��
ȫ�ļ�����صĴ����һ��Ϊ76xx��99xx��300xx
���˻����error log�⣬�������һ��Full-text crawl log������ʽΪsql<databas
e id>+<catalog id>.log��Ҳ����־ͬ���λ�ã��ҵĻ����ϵ���־�ļ���ΪSQLFT0000
700006.LOG�����database_idΪ7��catalog_idΪ6����
event log��¼���صĴ���
Ҳ����crash dump���ļ����ʽΪsqldmprxxx.mdmp��

�ڸı��˼ܹ�����ܷ����һ���������ȫ������stuckס�޷�ǰ����ܵ�ԭ��Ϊmiss
ing event��background task������󡣾���Ļ���Ҫͨ��ʹ��sys.sysprocesses, 
sys.dm_os_wait_tasks�ȼ��background task��FT GATHERER tasks����
����������Ϊ���¼��֣�
a. word breaker���ִ������������ô���
b. word breaker����ij����ѯ������
c. ������ݹ�࣬���岻����
d. �������ع�ߣ�һ����ٷ���

�µĹ��ߣ�
��ǰ������Ϊ���Զ���ɹؼ��֣����ʲô�ؼ��ֶ��Ǻ�����������������sys.dm_ft
s_index_keywords��sys.dm_fts_index_keywords_by_document�����鿴��
�������Ϊ���صĽ���Ļ�����sys.dm_fts_parser() ���鿴���߼���������lrtes
t.exe������һ��ֻ����debugging��

�����ȿ����������Ժ���ij�����о����о������⿪ƪ��

���
SQL Server 2008 Full-Text Search: Internals and Enhancements
http://technet.microsoft.com/en-us/library/cc721269.aspx
ȫ������ 
http://www.cnblogs.com/liulun/articles/1368655.html 
--
Welcome to Database Board
��ӭ������ݿ��
http://bbs.sjtu.edu.cn/bbsdoc?board=database

�� ��Դ:����ˮ˼Դ bbs.sjtu.edu.cn��[FROM: 207.46.55.28]
Technical Details
Message-ID: <4eQajX$aKX@bbs.sjtu.edu.cn>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news2.google.com!news.glorb.com!news.neu.edu.cn!news.shec6.edu.cn!SJTU

Show Full Headers
Complete Article Headers
X-Google-Thread: 101948,afb503bb471ae347,start
X-Google-Attributes: gid101948,domainid0,public,usenet
X-Google-Language: Chinese,GB
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news2.google.com!news.glorb.com!news.neu.edu.cn!news.shec6.edu.cn!SJTU
From: Dem.bbs@bbs.sjtu.edu.cn (Galaxy��VOLUNTEERS��Database)
Newsgroups: cn.bbs.comp.database
Subject: SQL Server 2008 Full-Text Search Overview
Date: 13 Feb 2009 08:17:31 GMT
Organization: ��ˮ˼Դ
Message-ID: <4eQajX$aKX@bbs.sjtu.edu.cn>
Mime-Version: 1.0
Content-Type: text/plain; charset="gb2312"
Content-Transfer-Encoding: 8bit
X-Filename: database/M.1234513041.A