I'm having quite a bit of difficulty finding a good solution for this:
Let's say I have a table of "Company", with a column called "Name". I have a full-text catalog on this column. If a user searched for "Very Good Company", my query would be:
SELECT * FROM Company WHERE CONTAINS(Name, '"Very" AND "Good" AND "Company"')
The problem is in this example, the word "Very" shows up in the standard list of stopwords:
SELECT ssw.* FROM sys.fulltext_system_stopwords ssw WHERE ssw.language_id = 1033;
Resulting in the query returning with no rows, even though there is a row with the name "Very Good Company".
My question is, how would I go about turning the stopwords off for my query? Or how would I go about removing them entirely?
Or is there another way I should be going about this search?
UPDATE tbl SET message = TRIM(REPLACE(CONCAT(' ', REPLACE(message, ' in ', ' in '), ' '), ' in ', '')); Edit: What you also have to consider is that stopwords in the middle of the message still have to retain the space after they're replaced, because you don't want to end up with no I in team -> no Iteam .
Expand Tables, and right-click the table that you want to disable or re-enable for full-text indexing. Select Full-Text index, and then click Disable Full-Text index or Enable Full-Text index.
To prevent a full-text index from becoming bloated, SQL Server has a mechanism that discards commonly occurring strings that do not help the search. These discarded strings are called stopwords. During index creation, the Full-Text Engine omits stopwords from the full-text index.
In case anyone else stumbles upon this problem:
It looks like there is an option to do this in 2008; it wasn't apparent to me because the database was upgraded from 2005 where I don't believe this was an option.
The first thing you need to do is set the compatibility level up to 2008:
ALTER DATABASE [MyDatabase] SET COMPATIBILITY_LEVEL = 100
Then, when creating the full-text index through the wizard, there is a step that allows you to ignore stopwords for the index
edit: Here's the script to do it as well:
ALTER FULLTEXT INDEX ON MyTable SET STOPLIST = OFF
By default in SQL Server the stopwords are not ignored.
This is what you want to do:
sp_configure 'show advanced options', 1; RECONFIGURE; GO sp_configure 'transform noise words', 1; RECONFIGURE; GO
REF: http://msdn.microsoft.com/en-us/library/ms187914%28v=sql.100%29.aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With