我必须通过脚本设置SQL全文搜索(无GUI) 我一直在网上看,但我找不到适合我的答案。
我在下面有一个简单的表(简化它),我想使用全文搜索:
DownloadTable
ID int primary key idenity,
Title varchar(30),
Description varchar(100),
Category Varchar(100),
URL varchar(100)
这就是我所做的
/*Enable Full Text Search*/
EXEC sp_fulltext_database enable
/*Create Search Catalog*/
CREATE FULLTEXT CATALOG MySearchCat
WITH ACCENT_SENSITIVITY = ON
AUTHORIZATION [dbo]
/*Create Full Text Index
CREATE FULLTEXT INDEX ON [dbo]. [DownloadTable]
(Title ,Description)
KEY INDEX iD ON [Test]
WITH CHANGE_TRACKING AUTO
GO
这是我被困的地方?是关键索引,假设是从我的下载表,那里是download.id?或者它是否在搜索目录中?我不能只是组成一个名字,因为它不起作用?但我不能使用ID?
答案 0 :(得分:4)
create table
DownloadTable (
ID int identity, constraint pk_DownloadTable primary key (id),
Title varchar(30),
Description varchar(100),
Category Varchar(100),
URL varchar(100)
)
/*Create Search Catalog*/
CREATE FULLTEXT CATALOG MySearchCat
WITH ACCENT_SENSITIVITY = ON
AUTHORIZATION [dbo]
CREATE FULLTEXT INDEX ON [dbo]. [DownloadTable]
(Title ,Description)
KEY INDEX pk_DownloadTable ON MySearchCat
WITH CHANGE_TRACKING AUTO
GO