Beispiel #1
0
        public static string[] StemmingWithSQLServer(Langs lang, string phrase)
        {
            var ctx = new FulltextContext();
            var sql = string.Format("SELECT display_term FROM sys.dm_fts_parser('FormsOf(INFLECTIONAL, \"{0}\")', {1}, 0, 1)", phrase.Replace("'", "''") /*https://stackoverflow.com/questions/5528972/how-do-i-convert-a-string-into-safe-sql-string*/, Metas.lang2LCID(lang));

            return(ctx.Set <dm_fts_parser>().FromSql(sql).Select(p => p.display_term).ToArray());
        }