Sql Server 2008 不会忽略全文短语查询中的干扰词?
假设我们有一个带有全文字段的表。该字段称为文本
。该表的内容为:
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
这样的短语时,它只会索引 car
和 wash
。这是真的吗?
另外,当我查询 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看这篇文章:
停用词
fts忽略“and”词后,“car”和“wash”位置将是1和3。所以找不到。
我建议改用另一个术语。也许您想使用“洗车”或其他术语。这取决于业务逻辑
Look at this article:
stopwords
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