SQL 2008: Turn off Stop Words for Full Text Search Query

前端 未结 3 475
说谎
说谎 2020-12-05 10:15

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 c

相关标签:
3条回答
  • 2020-12-05 10:43

    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
    
    0 讨论(0)
  • 2020-12-05 11:00

    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

    0 讨论(0)
  • 2020-12-05 11:04

    I was having this issue earlier today with the full text search.

    151-663049 - returns result
    151-66304 - no result
    151-6630 - no result
    151-663 - no result
    151-66 - no result
    151-6 - returns result
    151 - returns result
    151 returns result
    

    But I read a post that says to get around the issue to append a * to the end of each search. http://social.msdn.microsoft.com/Forums/sqlserver/en-US/fae33a6b-7c7c-4c11-842c-ca5277ed824f/ms-sql-server-2008-r2-fulltext-search-problem

    151-663049* - returns result
    151-66304* - returns result
    151-6630* - returns result
    151-663* - returns result
    151-66* - returns result
    151-6* - returns result
    151-* - returns result
    151* - returns result
    

    So in your parameter just append * to your searches and problem solved.

    0 讨论(0)
提交回复
热议问题