SQL Contains()不返回"The"的结果 [英] SQL Contains() not returning results for 'The'

查看:58
本文介绍了SQL Contains()不返回"The"的结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我具有如下用于查询 ContactInfoes

SELECT * 
FROM ContactInfoes
WHERE CONTAINS(Name, 'The') 

我只得到空结果集.我的表中有一个名为公司"的条目.

I am getting only empty result set. I have an entry in my table with Name 'The Company'.

为什么我在这里没有任何数据以及如何解决这个问题.感谢您的帮助.

Why I am not getting any data here and how this can be resolved. Any help is appreciated.

我正在使用SQL Server 2019

I am using SQL Server 2019

推荐答案

您已创建FULLTEXT索引而未指定STOPLIST.因此,使用了默认的STOPLIST.默认情况下,单词"the"是停用词,已从文本中删除.如果要通过单词"the"进行搜索,则应创建一个空的STOPLIST,然后在FULLTEXT INDEX中指定此STOPLIST.您可以通过查询检查的默认停用词:

You have created FULLTEXT index without specifying STOPLIST. Thus, the default STOPLIST was used. By default the word 'the' is the stop word, that removed from your text. If you want to search by word 'the' you should create an empty STOPLIST and then specify this STOPLIST in your FULLTEXT INDEX. The default stop words you can check by query:

SELECT *
FROM sys.fulltext_system_stopwords
WHERE language_id = 1033 -- English

然后您可以创建一个空的STOPLIST:

Then you can create empty STOPLIST:

CREATE FULLTEXT STOPLIST MyEmptyStopList;  
GO 

然后将其设置为您的全文索引:

Then set it into your FULLTEXT INDEX:

CREATE FULLTEXT INDEX ON table_name ... STOPLIST = MyEmptyStopList;

这篇关于SQL Contains()不返回"The"的结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆