gpt4 book ai didi

sql - CONTAINSTABLE 查询无法识别小单词

转载 作者:行者123 更新时间:2023-12-03 03:08:29 24 4
gpt4 key购买 nike

我正在使用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 如何与这些较小的单词一起使用,还是应该将它们完全排除?如果这些较小的词在搜索中确实有意义,那么如何将它们包含在搜索中?

最佳答案

这些不是“小词”,这些是停用词列表上的常见词。它们被忽略。

参见Stopwords and Stoplists关于 BOL。

关于sql - CONTAINSTABLE 查询无法识别小单词,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3821749/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com