Sql Server 2008 不会忽略全文短语查询中的干扰词?

发布于 2024-11-26 21:33:10 字数 848 浏览 1 评论 0原文

假设我们有一个带有全文字段的表。该字段称为文本。该表的内容为:

car wash
car and wash

单词 and 位于我的 stoplist

现在,我将使用以下 sql 查询该表:

select * from mytable
where contains(text, '"car wash"')

此查询仅返回 carwash 行而不是洗车 行。假设单词 and 是停用词,为什么 Sql 不返回 car andwash 行?

我知道我正在进行短语搜索(使用“”)。这正是我所需要的,但我认为 Sql 应该忽略停止列表中的单词,但事实并非如此。这让我发疯。

我的理解是,当 FT 算法找到像 car andwash 这样的短语时,它只会索引 carwash。这是真的吗?

另外,当我查询 ft_parser 时,它会说出我所期望的内容:

SELECT * FROM sys.dm_fts_parser ('"car and wash"', 1033, 5, 0)

    special_term    display_term    
    Exact Match         car 
    Noise Word          and 
    Exact Match         wash    

有什么想法吗?

Lets assume we have a table with a fulltext field on it. This field is called text. The content of the table would be:

car wash
car and wash

The word and is in my stoplist

Now, I will query this table using this sql:

select * from mytable
where contains(text, '"car wash"')

This query only returns the car wash row and not the car and wash row. By assuming that the word and is a stop word, why is not Sql returning the car and wash row?

I know I am doing a phrasal search (using ""). That is exactly what I need, but I think that Sql should ignore words in the stop list and that is not what is happening. It is driving me crazy.

My understand is that when FT algorithm finds a phrase like car and wash it will index only car and wash. Is this true?

Also when I query the ft_parser it says what I expected it to say:

SELECT * FROM sys.dm_fts_parser ('"car and wash"', 1033, 5, 0)

    special_term    display_term    
    Exact Match         car 
    Noise Word          and 
    Exact Match         wash    

Any thoughts?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

亣腦蒛氧 2024-12-03 21:33:10

看这篇文章:
停用词

虽然 fts 忽略了停用词的包含,但全文索引确实考虑了它们的位置

fts忽略“and”词后,“car”和“wash”位置将是1和3。所以找不到。

我建议改用另一个术语。也许您想使用“洗车”或其他术语。这取决于业务逻辑

Look at this article:
stopwords

Although fts ignores the inclusion of stopwords, the full-text index does take into account their position

after fts ignores "and" word, "car" and "wash" positions will be 1 and 3. So it can't be found.

I suggest another term instead. Maybe you would like to use something like 'car AND wash', or other term. That depends on business logic

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文