Results 1 to 4 of 4

Thread: [RESOLVED] SQL Server '05: How to get fulltext search not to ignore hyphens

  1. #1

    Thread Starter
    Fanatic Member aconybeare's Avatar
    Join Date
    Oct 2001
    Location
    UK
    Posts
    772

    Resolved [RESOLVED] SQL Server '05: How to get fulltext search not to ignore hyphens

    Hi,

    I am using sql server 2005 fulltext search and would like to be able to search for scientific terms e.g. "5-HT"

    Does anyone know how to tell sql server not to ignore the hypen?

    Regards Allan

  2. #2
    Frenzied Member
    Join Date
    Jan 2006
    Posts
    1,875

    Re: SQL Server '05: How to get fulltext search not to ignore hyphens

    may be you should look at this MS KB

    Code:
    WORKAROUND
    To work around this problem, avoid using special characters in thesaurus file terms.
    
    STATUS
    Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.
    __________________
    Rate the posts that helped you

  3. #3

    Thread Starter
    Fanatic Member aconybeare's Avatar
    Join Date
    Oct 2001
    Location
    UK
    Posts
    772

    Re: SQL Server '05: How to get fulltext search not to ignore hyphens

    Riteshjain,

    Thanks for your reply, I'm not using the thesaurus file but the article described similar symptoms to the one's I'm experiencing and it gave me an idea for a workaround.

    The following is for anyone interested in my solution/hack -

    I've created a new field called FTS_Data nvarchar(max) with a full-text catalog and added a trigger to the table which populates the FTS_Data field. I strip out any hyphens ("- " & "-"), this means the base data remains unadultered and the search data will return accurate results.

    When constructing my search string using (in my case) containstable I look for and strip out "- " & "-"

    Code:
    ...CONTAINSTABLE(mytable,(fts_data),'"5HT*"')...
    Allan
    Last edited by aconybeare; Jul 23rd, 2008 at 07:02 AM.

  4. #4
    Frenzied Member
    Join Date
    Jan 2006
    Posts
    1,875

    Re: [RESOLVED] SQL Server '05: How to get fulltext search not to ignore hyphens

    glad to know your problem is solved and thanks for workaround.
    __________________
    Rate the posts that helped you

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width