Let’s assume we have a large full text index table and there are some strings like that (in the full text indexed collumn, of course):
123.456.789/14
111.222.22222.2/5111
Those strings are numbers that only make sense (for my application) when they are queried exactly the way I wrote.
When I perform a query like this:
WHERE CONTAINS(field, "5111");
it returns the line that contains the second string, but I exected it to not return any results because besides the string contains 5111, it does not make sense to me (only makes sense the entire number, not part of it).
Is there any way of avoiding returning parts of strings like those I mentioned? I guess Sql server is treating “/” and “.” as stop words, Am I right?
Your problem is actually with the word breaker, not stop words.
“/” and “.” are being considered word separators by the (I assume English) word breaker you are using.
It is possible to install custom word breakers, but I’m not sure if this would actually resolve your problem since you want “/” considered a word separator when it is around words but not numbers.
It is theoretically possible to enable Custom Dictionary support to allow specifying phrases that contain word separators that are considered words, but this may not deliver what you want.
From your example you could define “789/14” and “2/5111” with a Custom Dictionary. This would mean that these rows would not be returned for searches for “789”, “14”, “2” or “5111” but they would be returned for searches on “789/14” or “2/5111”.
The following blog entry describes setting up Custom Dictionary support in SQL 2008, however I have not been able to make it work:
Creating Custom Dictionaries for special terms to be indexed ‘as-is’ in SQL Server 2008 Full-Text Indexes