Reputation: 320
I'm using MS SQL Server 2008 R2 with Full Text Search for searching text data stored in different languages.
I'm a bit confused about how CONTAINS
predicate works with accents.
When I use the following predicate
CONTAINS([Text], @keywords , Language @language)
on a catalog with ACCENT_SENSITIVITY = OFF
the search results are the same for e.g. 'Lächeln' and 'lacheln' when Germany is specified as language.
But if I change the predicate to look like
CONTAINS([Text], FORMSOF(INFLECTIONAL, @keywords) , Language @language)
then results are different and it seems to me that Accent Insensitivity doesn't work with FORMSOF
I've tried to find an answer on MSDN and Google but didn't find anything useful.
Does anybody know why the results are different?
Thanks!
Upvotes: 4
Views: 1654
Reputation: 369
FORMSOF cuts diacritics from Your word:
SELECT * FROM sys.dm_fts_parser(N'FORMSOF(INFLECTIONAL, "Lächeln")', 1031, 0, 1)
check column "display_term".
Upvotes: 0
Reputation: 2343
My understanding is that these serve two separate purposes in finding matches for a full-text search. With an accent insensitive catalog there is a simple character equality performed for the term matching so that eñya = enya because 'n' is considered the accent insensitive equivalent of 'ñ'.
With FORMSOF you're requesting that the search perform a stemming operation on the terms so that verb and noun forms will be searched as additional terms in the search. e.g. searching for 'foot' would include 'feet' and 'run' would include 'ran'.
If the FORMSOF seems to be fundamentally not working for your values you may want to make sure that you have the appropriate language support installed for full-text languages.
SELECT * FROM sys.fulltext_languages
If you haven't had a chance to review MSDN the SQL Word Breakers documentation may shed some light on the observed behavior. http://msdn.microsoft.com/en-us/library/ms142509.aspx
Upvotes: 0