加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > MsSql教程 > 正文

为什么SQL全文索引不会返回包含#的单词的结果?

发布时间:2020-12-12 16:54:09 所属栏目:MsSql教程 来源:网络整理
导读:例如,我的查询如下所示使用SQL Server 2005: SELECT * FROM Table WHERE FREETEXT(SearchField,'c#') 我有一个全文索引定义为使用列SearchField返回结果使用时: SELECT * FROM Table WHERE SearchField LIKE '%c#%' 我相信#是一封特别的信,那么如何让FREETE
例如,我的查询如下所示使用SQL Server 2005:
SELECT * FROM Table WHERE FREETEXT(SearchField,'c#')

我有一个全文索引定义为使用列SearchField返回结果使用时:

SELECT * FROM Table WHERE SearchField LIKE '%c#%'

我相信#是一封特别的信,那么如何让FREETEXT能正常工作呢?

解决方法

#char被标记为标点符号,因此被忽略,因此我们将从我们的字索引忽略列表中删除字母C.

这样做后,在本地测试并重建索引,我得到结果!

在索引列上查看使用不同的断字符语言,以使这些特殊字符不被忽略.

编辑:我也发现this information:

c# is indexed as c (if c is not in your noise word list,see more on noise word lists later),but C# is indexed as C# (in SQL 2005 and SQL 2000 running on Win2003 regardless if C or c is in your noise word list). It is not only C# that is stored as C#,but any capital letter followed by #. Conversely,c++ ( and any other lower-cased letter followed by a ++) is indexed as c (regardless of whether c is in your noise word list).

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读