Strange behaviour with Fulltext search in SQL Server

纵然是瞬间 提交于 2019-12-05 03:04:18

This is because the @Keyword is not wrapped in double quotes. Which forces zero, one, or more matches.

Specifies a match of words or phrases beginning with the specified text. Enclose a prefix term in double quotation marks ("") and add an asterisk () before the ending quotation mark, so that all text starting with the simple term specified before the asterisk is matched. The clause should be specified this way: CONTAINS (column, '"text"'). The asterisk matches zero, one, or more characters (of the root word or words in the word or phrase). If the text and asterisk are not delimited by double quotation marks, so the predicate reads CONTAINS (column, 'text*'), full-text search considers the asterisk as a character and searches for exact matches to text*. The full-text engine will not find words with the asterisk (*) character because word breakers typically ignore such characters.

When is a phrase, each word contained in the phrase is considered to be a separate prefix. Therefore, a query specifying a prefix term of "local wine*" matches any rows with the text of "local winery", "locally wined and dined", and so on.

Have a look at the MSDN on the topic. MSDN

Have you tried to query the following view to see what's on the system stoplist?

select * from sys.fulltext_system_stopwords where language_id = 1033;

Found a solution that works. I've added language 1033 as an additional parameter.

SELECT * FROM MyTable WHERE CONTAINS(Message, @Keyword, langauge 1033) 
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!