例如,我的查询如下所示使用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).