我使用的是sql server 2019,我根据微软的例子创建了全文索引,但是有一个问题,在文本中搜索部分单词时,没有结果
sql服务器版本:
Microsoft SQL Server 2019 (RTM-CU13) (KB5005679) - 15.0.4178.1 (X64)
Sep 23 2021 16:47:49
Copyright (C) 2019 Microsoft Corporation
Enterprise Edition (64-bit) on Windows Server 2019 Datacenter 10.0 <X64> (Build 17763: ) (Hypervisor)
例如 :
CREATE TABLE Flags (Country nvarchar(30) NOT NULL, FlagColors varchar(200));
CREATE UNIQUE CLUSTERED INDEX FlagKey ON Flags(Country);
INSERT Flags VALUES ('France', 'Blue and White and Red');
INSERT Flags VALUES ('Italy', 'Green and White and Red');
INSERT Flags VALUES ('Tanzania', 'Green and Yellow and Black and Yellow and Blue');
SELECT * FROM Flags;
GO
CREATE FULLTEXT CATALOG TestFTCat;
CREATE FULLTEXT INDEX ON Flags(FlagColors) KEY INDEX FlagKey ON TestFTCat;
GO
现在我搜索这个词blu
,但尽管这个词没有结果blue
(我需要一个模糊搜索)
像这样的查询:
SELECT * FROM FREETEXTTABLE (Flags, FlagColors, 'Blu');
是什么原因?
试试这个:
https://learn.microsoft.com/en-gb/archive/blogs/sqlforum/faq-how-can-i-perform-wildcard-searches-in-full-text-search