Why isn't my single-character full text search working?

家住魔仙堡 提交于 2020-06-12 15:19:52

问题


Given this code, I'm getting back no results:

SELECT TOP 10 * FROM MyTable WHERE CONTAINS(TextColumn, '"W"')

Things I've checked:

  • Longer words return a result
  • There are no stop LIST associated with this index
  • There is definitely text such as "James W Brown" in the column
  • The full text index is up to date.

EDIT: I was looking for a stop lists, not a stop word, associated with the index.


回答1:


The answer is to make sure you have an empty stop list associated with the index. It isn't enough to simply have no stop list, as it would just use the default stop list.

CREATE FULLTEXT STOPLIST [EmptyStopList] ;
GO
ALTER FULLTEXT INDEX ON MyTable SET STOPLIST [EmptyStopList]



回答2:


Full text Search is a feature to do Language Specific Search.

The search may ignore the literal strings in the data and search for a specific word in a language , (Inflectional forms of a specific word, Synonymous etc) which is specific to a language.

Here in your query you are looking for the Letter "W" which isnt a word in english, its an alphabet but alone it doesn't mean anything. It is more like a pattren in a string for that purpose you should use LIKE key word along with wildcard % which will bring back the string value James W Brown.

On the other hand if you a wanted to use FTS to find all the possible James in your database then FTS can be handy. By doing a THESAURUS search on James which will bring back Jim, Jimmy, Jimmie etc but then again you will have to edit the XML files under FDData for a specific language to make this happen.



来源:https://stackoverflow.com/questions/28243095/why-isnt-my-single-character-full-text-search-working

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