开发者

SQL Server 2005 Full text search - Valid Thesaurus characters

开发者 https://www.devze.com 2022-12-26 00:46 出处:网络
开发者_运维技巧FORMSOF THESAURUS throws errors for specific character. E.g. FORMSOF (THESAURUS, hel!lo) throws an error whereas FORMSOF (THESAURUS, hel?lo) works.

开发者_运维技巧FORMSOF THESAURUS throws errors for specific character. E.g. FORMSOF (THESAURUS, hel!lo) throws an error whereas FORMSOF (THESAURUS, hel?lo) works.

However, I did not find any documentation about which characters are allowed.

Can you help me out?


The Thesaurus is expecting a word or term:

http://msdn.microsoft.com/en-us/library/cc879300(v=sql.110).aspx

What I do in my .NET code is use a regex to remove all those special characters (basically leaving A-Z and 0-9.

http://msdn.microsoft.com/en-us/library/aa258227(v=sql.80).aspx

says:

word

Is a string of characters without spaces or punctuation.

phrase

Is one or more words with spaces between each word.

Make sure you have your stop words setup (I did have changed to have none of them in my code)

Stopwords

When defining a full-text query, the Full-Text Engine discards stopwords (also called noise words) from the search criteria. Stopwords are words such as "a," "and," "is," or "the," that can occur frequently but that typically do not help when searching for particular text. Stopwords are listed in a stoplist. Each full-text index is associated with a specific stoplist, which determines what stopwords are omitted from the query or the index at indexing time. For more information, see Stopwords and Stoplists.

There is also an awesome library for .net here: (I used that to transform phrases in full text queries) http://www.sqlservercentral.com/articles/Full-Text+Search+(2008)/64248/

EDIT: This might help: Note that I did replace 's to nothing or else That's becomes Thats and would be a no match.

search = search.Replace("’s", "");
search = Regex.Replace(search, @"[#$%&()*“”+,./:;<=>!?@[\\\]^_`’{|}~]", "");
0

精彩评论

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