根据 MSDN,我在编辑同义词库文件后执行了此操作,该文件将英文文件 ( tseng.xml
) 加载到同义词库中:
EXEC sys.sp_fulltext_load_thesaurus_file 1033;
GO
词库文件的迷你样本部分
<XML ID="Microsoft Search Thesaurus">
<thesaurus xmlns="x-schema:tsSchema.xml">
<diacritics_sensitive>0</diacritics_sensitive>
<expansion>
<sub>car</sub>
<sub>coche</sub>
<sub>automobile</sub>
<sub>ride</sub>
</expansion>
</thesaurus>
</XML>
索引列 c.keywords 字段由 'bike,car' 快速检查查询:
DECLARE @strsearch varchar(200)
SET @strsearch = 'automobile'
SELECT adid from ads INNER JOIN campaign c ON ads.campid=c.campaignid
WHERE
FREETEXT(c.keywords, @strsearch)
RESULTS
========
ad NULL
寻找“汽车”的自由文本确实有效
DECLARE @strsearch varchar(200)
SET @strsearch = 'car'
SELECT adid from ads INNER JOIN campaign c ON ads.campid=c.campaignid
WHERE
FREETEXT(c.keywords, @strsearch)
RESULTS
========
ad 41
因此,使用同义词库的 FREETEXT 不会返回任何结果。我认为默认情况下 FREETEXT 使用同义词库文件。我究竟做错了什么?