private List <TextPosition> GetHighlightPositions(string htmlText, ApisLucene.Classes.Eucases.Highlight.Config.IConfig config,
                                                          ApisLucene.Classes.Eucases.Stemming.IStemmer stemmer, string searchText, bool exactMatch)
        {
            BaseParser parser = new BaseParser(config, new BaseTokenizer(config), stemmer);

            string noTagshtmlText = Regex.Replace(htmlText, @"\<[^\<\>]*?\>", delegate(Match m)
            {
                return("".PadLeft(m.Value.Length, ' '));
            });

            parser.AnalizeText(noTagshtmlText);

            //int freeWords = 30;
            //bool isPhrase = false;

            try
            {
                List <TextPosition> res = parser.FindLema(searchText, !exactMatch);

                return(res);
            }
            catch (Exception)
            {
                return(new List <TextPosition>());
            }
        }
        public string HighlightHtmlEuroCases(string htmlText, string searchText, int langIdOfDoc)
        {
            ApisLucene.Classes.Eucases.Highlight.Config.IConfig config  = null;
            ApisLucene.Classes.Eucases.Stemming.IStemmer        stemmer = null;

            switch (langIdOfDoc)
            {
            case 1: config = new BgConfig(); stemmer = new BgStemmer(); break;

            case 2: config = new DeConfig(); stemmer = new DeStemmer(); break;

            case 3: config = new FrConfig(); stemmer = new FrStemmer(); break;

            case 4: config = new EnConfig(); stemmer = new EnStemmer(); break;

            default: config = new EnConfig(); stemmer = new EnStemmer(); break;
            }

            var    highlightPositions = this.GetHighlightPositions(htmlText, config, stemmer, searchText, false);
            string heighlightedHtml   = this.AppendHighlights(htmlText, highlightPositions);

            return(heighlightedHtml);
        }