开发者

SQL Server Full Text Search - Is it possible to search in the middle of a word?

I have full text search on my database.

Is it possible to se开发者_如何学Goarch 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.


This looks like it has come up before and the short answer was "No". Previous thread


You can use CONTAINS. See this link

Full text catalog/index search for %book%


The only way to do this search is to add a "rotational" break down of the words. As an exemple, the word "locomotion" will be break down into 9 new "word" like : "ocomotion" "comotion" "omotion" "motion" "otion" "tion" "ion" "on" "n" So now you can put this table into the Full Text Search (or create à new columns with all these parts of the word) to find it quickly.

I wrote a paper to do that without FTS (but it is in french) : https://blog.developpez.com/sqlpro/p13123/langage-sql-norme/like-mot-ou-les-index-rotatifs


You can use CONTAINS instead of LIKE.

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜