Asterisk通配符在SQL Server全文搜索中不起作用

时间:2012-06-21 09:23:24

标签: sql-server full-text-search prefix

Select d.Path 
from Documents d 
inner join (SELECT FT_TBL.DocumentId, KEY_TBL.RANK as ranks
            FROM FullTextCatalog AS FT_TBL 
            INNER JOIN FREETEXTTABLE(FullTextCatalog, Icerik, 
            ' "hısım*" ' ) AS KEY_TBL
            ON FT_TBL.DocumentId = KEY_TBL.[KEY]) as results on d.Id = results.DocumentId 
order by results.ranks

此查询仅返回具有“hısım”字本身的行。但预期的结果应该有“hısım”这个词及其前缀。我对吗?即“hısımlar”,“hısımları”等。

所以我错过了什么?

1 个答案:

答案 0 :(得分:0)

我认为你应该使用CONTAINSTABLE

Select d.Path 
from Documents d 
inner join (SELECT FT_TBL.DocumentId, KEY_TBL.RANK as ranks
        FROM FullTextCatalog AS FT_TBL 
        INNER JOIN CONTAINSTABLE(FullTextCatalog, Icerik, 
        ' "hısım*" ' ) AS KEY_TBL
        ON FT_TBL.DocumentId = KEY_TBL.[KEY]) as results on d.Id = results.DocumentId 
order by results.ranks

它适用于我的例子。