我已经安装了SQL Server 2012,然后执行了
select document_type
from sys.fulltext_document_types
结果是50个扩展,好的。
然后我从Microsoft站点下载了FilerPack SP2,安装了它,执行了
EXEC sp_fulltext_service 'load_os_resources', 1
EXEC sp_fulltext_service 'update_languages'
重新启动SQL Server并执行:
select document_type
from sys.fulltext_document_types
结果是151个扩展名,包括.pdf,.cs等。
然后:
create table DocumentRepository
(
id int not null primary key identity,
fileName nvarchar(250),
fileSize int,
fileExtension NVARCHAR(10),
attachment varbinary(max)
);
GO
GRANT INSERT,UPDATE,SELECT,DELETE on DocumentRepository to public;
GO
CREATE FULLTEXT CATALOG FTSCatalog AS DEFAULT;
GO
CREATE FULLTEXT INDEX ON dbo.DocumentRepository
(fileName, attachment TYPE COLUMN fileExtension)
KEY INDEX PK__Document__3213E83FEFB4F2B9
ON FTSCatalog
WITH CHANGE_TRACKING AUTO;
GO
并添加了一些文件:.pdf,.txt,.cs,.docx
最后执行:
select *
from DocumentRepository
where contains(*, N'Firefox')
------
0, (word inside pdf field)
select *
from DocumentRepository
where contains(*, N'Appender')
-----
0, (word inside .cs)
select *
from DocumentRepository
where contains(*, N'database')
--------
dbw.txt 3 .txt
mydoc.docx 11 .docx
为什么FTS不会搜索.pdf
,.cs
个文件?