SQL Server全文搜索 - 是否可以在单词中间搜索? [英] SQL Server Full Text Search - Is it possible to search in the middle of a word?

查看:100
本文介绍了SQL Server全文搜索 - 是否可以在单词中间搜索?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



是否可以在单词的中间搜索某些文本?



例如,我有一列描述,其中包含以下文本:

  Revolution 

是否有可能搜索'EVO'并让它在Revolution中找到它或者我坚持做一个LIKE :

  SELECT * FROM表格说明LIKE'%EVO%'

是否存在与上述查询相同的FTS?
$ b 编辑 <
我想说清楚我想问什么,因为它可能会让一些人感到困惑。我相信 SQL Server FTS只能在单词的开头搜索(前缀搜索)。因此,如果我查询如下:

$ pre $ SELECT $ FROM表WHON CONTAINS(描述''Revo *'')

然后它会找到Revolution这个词。我想知道是否有可能在词的中间搜索某些内容。不是最后。不是在一开始。从它看起来这是不可能的,它是有道理的,因为SQL服务器如何索引这个,但我只是想确定。

解决方案

您可以使用 CONTAINS 。看到这个链接



全文目录/索引搜索%book%


I have full text search on my database.

Is it possible to search in the middle of a word for some text?

For example, I have a column Description that contains the following text:

Revolution

Is it possible to search for 'EVO' and have it find it in the word Revolution or am I stuck doing a LIKE:

SELECT * FROM Table WHERE Description LIKE '%EVO%'

Is there a FTS equivalent of the above query?

EDIT
I want to make it clear what I am trying to ask because it appear a few people might be confused. I believe that SQL Server FTS can only search at the beginning of the word (prefix search). So if I query like:

SELECT * FROM Table WHERE CONTAINS(Description, '"Revo*"')

Then it will find the word Revolution. I want to know if it is possible at all to search something in the MIDDLE of the word. Not at the end. Not at the beginning. From what it looks like this is not possible and it makes sense because how would SQL server index this, but I just wanted to be certain.

解决方案

You can use CONTAINS. See this link

Full text catalog/index search for %book%

这篇关于SQL Server全文搜索 - 是否可以在单词中间搜索?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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