SQL server freetexttable partial words

2019-07-31 09:46发布

I'm using SQL free text searching for the first time and I'm a little confused why it behaves the way it does.

I have a table of contacts which users can search and I'm using

SELECT Contacts.*, [Rank]
FROM 
FREETEXTTABLE (Contacts, *, 'O''Roarty') AS Contact1_ftt
JOIN Contacts ON Contacts.ContactID = Contact1_ftt.[Key]

which returns 2 results on people with "O'Roarty" as their surname. However if I search for "Roarty" I get no results at all. The same happens if I search for "Dave" I get results but "Dav" no results.

Its looks like partial words don't work. Is there a way to enable partial word matches as well?

2条回答
We Are One
2楼-- · 2019-07-31 10:10

First thing Full-Text search does not support suffix search. So you cannot search using "*ave". Second regarding the uses of LIKE, LIKE AND FTS works differently. Look here for more detail.

查看更多
SAY GOODBYE
3楼-- · 2019-07-31 10:22

This MSDN Question/Answer better explains the functionality than I can, so I'll just link it here.

You basically want to be using CONTAINSTABLE if you want partial word matches.

查看更多
登录 后发表回答