【发布时间】:2008-09-05 08:43:48
【问题描述】:
这似乎是 SQL 全文索引的奇怪行为。
FTI 将数字存储在其索引中,前缀为“NN”,因此“123”保存为“NN123”。
现在,当用户搜索以 N 开头的单词(即包含 "n*" )时,他们也会得到所有数字。
所以:
select [TextField]
from [MyTable]
where contains([TextField], '"n*"')
返回:
MyTable.TextField -------------------------------------------------- 此文本包含单词 navigator 这个文不错 此文本只有 123,不应返回有没有排除最后一行的好方法?是否有一致的解决方法?
需要那些额外的“”才能使通配符令牌起作用:
select [TextField] from [MyTable] where contains([TextField], 'n*')
将搜索文字 n* - 并且没有。
--return rows with the word text
select [TextField] from [MyTable] where contains([TextField], 'text')
--return rows with the word tex*
select [TextField] from [MyTable] where contains([TextField], 'tex*')
--return rows with words that begin tex...
select [TextField] from [MyTable] where contains([TextField], '"tex*"')
【问题讨论】:
标签: sql-server full-text-search