4

CONTAINSTABLE用来搜索两个表格列。一旦搜索包含像 'the' 'for' 'a' 这样的小词,即使它们实际出现在列中,搜索也不会返回任何结果。

快速示例。正在搜索的列包含文本。'系统需要升级'

以下 SQL 返回 0 行

SELECT     * FROM Incident WHERE (TicketNumber IN (
SELECT TicketNumber FROM         [Action] FT_TBL INNER JOIN
CONTAINSTABLE(Action, Text, '"system" AND "needs" AND "to" AND "upgraded" AND NOT "Search Summary"') KEY_TBL ON FT_TBL.ID = KEY_TBL.[KEY]
UNION
SELECT TicketNumber FROM [Incident] FT_TBL INNER JOIN
CONTAINSTABLE(Incident, Subject, '"system" AND "needs" AND "to" AND "upgraded"') AS KEY_TBL ON FT_TBL.TicketNumber = KEY_TBL.[KEY]))

一旦 'to' 被省略,它就可以正常工作:

SELECT     * FROM Incident WHERE (TicketNumber IN (
SELECT TicketNumber FROM         [Action] FT_TBL INNER JOIN
CONTAINSTABLE(Action, Text, '"system" AND "needs" AND "upgraded" AND NOT "Search Summary"') KEY_TBL ON FT_TBL.ID = KEY_TBL.[KEY]
UNION
SELECT TicketNumber FROM [Incident] FT_TBL INNER JOIN
CONTAINSTABLE(Incident, Subject, '"system" AND "needs" AND "upgraded"') AS KEY_TBL ON FT_TBL.TicketNumber = KEY_TBL.[KEY]))

这些较小的单词如何CONTAINSTABLE使用,或者应该完全忽略它们?如果这些较小的词在搜索中实际上是有意义的,那么它们如何被包含在搜索中?

4

2 回答 2

3

这些不是“小词”,这些是停止名单上的常用词。他们被忽略了。

请参阅BOL 上的停用词和停用词表

于 2010-09-29T13:22:51.873 回答
1

请参阅我关于从空白开始创建和参与自定义全文停止列表的答案的结尾。我检查了一个空的,你的查询与“to”、“be”、“the”、“for”等一起使用。

更新:

SQL Server 2005 应该有 MSSQL\FTData\noiseENG.txt。
我建议查看“Sql Server 2005 全文搜索中的噪声词”问题的答案

于 2010-09-29T18:25:09.177 回答