Can I define which word breakers to use when building a mssql fulltext index?

江枫思渺然 提交于 2019-11-27 16:56:33

问题


I have created a fulltext catalog that stores the data from some of the columns in a table, but the contents seem to have been split apart by characters that I don't really want to be considered word delimiters. ("/", "-", "_" etc..)

I know that I can set the language for word breaker, and http://msdn.microsoft.com/en-us/library/ms345188.aspx gives som idea on how to install new languages - but I need more direct control than that, because all of those languages still break on the characters I want to not break on.

Is there a way to define my own language to use for finding word breakers?


回答1:


The ability to configure FTS indexing is fairly limited out of the box. I don't think that you can use languages to do this.

If you are up for a challenge, and have access to some C++ knowledge, you can always write a custom IFilter implementation. It's not trivial, but not too difficult. See here for IFilter resources.




回答2:


Full text indexes only consider the characters _ and ` while indexing. All the other characters are ignored and the words get split where these characters occur. This is mainly because full text indexes are designed to index large documents and there only proper words are considered to make it a more refined search.

We faced a similar problem. To solve this we actually had a translation table, where characters like @,-, / were replaced with special sequences like '`at`','`dash`','`slash`' etc. While searching in the full text, u've to again replace ur characters in the search string with these special sequences and search. This should take care of the special characters.



来源:https://stackoverflow.com/questions/3914798/can-i-define-which-word-breakers-to-use-when-building-a-mssql-fulltext-index

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