|
-
Jul 22nd, 2008, 11:05 AM
#1
Thread Starter
Fanatic Member
[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
-
Jul 22nd, 2008, 11:32 AM
#2
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 
-
Jul 23rd, 2008, 06:57 AM
#3
Thread Starter
Fanatic Member
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.
-
Jul 23rd, 2008, 08:37 AM
#4
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|