我正在使用CONTAINSTABLE
来搜索两个表格列。一旦搜索包含像''''这样的'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
如何与这些较小的单词一起使用,还是应该完全省略?如果这些较小的单词在搜索中实际上有意义,那么它们如何被包含在搜索中?
答案 0 :(得分:3)
这些不是“小词”,这些是停止列表中的常用词。他们被忽略了。
请参阅BOL上的Stopwords and Stoplists。
答案 1 :(得分:1)
有关创建和使用自定义全文停止列表的信息,请参阅the end of my answer。我查了一下,空的一个你的查询用“to”,“be”,“the”,“for”等等。
更新:
SQL Server 2005应该有MSSQL \ FTData \ noiseENG.txt 我建议您查看question "Noise Words in Sql Server 2005 Full Text Search"
的答案