开发者

SQL Full-Text-Search returns no results when any noise words are in search string

开发者 https://www.devze.com 2023-01-04 20:55 出处:网络
I have an asp.net web page used to search for company names in our database using FTS.They enter the company name in a search box and submit.

I have an asp.net web page used to search for company names in our database using FTS. They enter the company name in a search box and submit.

First I trim any leading or trailing spaces, then i replace each internal space with " NEAR ".

So a search for:

"The Association of Lefthanded Picklepickers"

Is fed as:

"The NE开发者_如何学编程AR Association NEAR of NEAR Lefthanded NEAR Picklepickers"

Into the following WHERE clause used by the search results grid:

WHERE CONTAINS(CompanyName, @Search)

This method works perfectly until a noise word (the, is, and, to, etc.) is part of users search. When this happens the SQL server returns no search results. In the case of the above search, the word "of" breaks the search even if a company with the exact title exists in the database.

What should I do to overcome this problem?

Your thoughts and advice are greatly appreciated!


Try using the transform noise words option as described here: http://technet.microsoft.com/en-us/library/ms187914(SQL.90).aspx

sp_configure 'show advanced options', 1
RECONFIGURE
GO
sp_configure 'transform noise words', 1
RECONFIGURE
GO
0

精彩评论

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