Пример #1
0
        public SearchWords PrepareRealWords(string[] words)
        {
            // Load index language:
            string   language = "";
            IndexCfg cfg      = IndexCfg.Load(cnn);

            if (cfg != null)
            {
                language = cfg.Language.ToLower();
            }

            // Normalize words, see if they are at the index and search synonymous:
            SearchWords synonimous = new SearchWords();

            foreach (string word in words)
            {
                string n = Normalize(word);
                if (!n.Equals(""))
                {
                    ArrayList currentSet = new ArrayList(3);
                    Word      wrd        = Word.Load(cnn, n);
                    if (wrd == null)
                    {
                        currentSet = SearchSynonyms(n, language);
                        if (currentSet.Count == 0)
                        {
                            // Word not found: Exit without results.
                            return(null);
                        }
                    }
                    else
                    {
                        currentSet.Add(wrd);
                        currentSet.AddRange(SearchSynonyms(n, language));
                    }
                    synonimous.WordSets.Add(currentSet);
                }
            }

            if (synonimous.WordSets.Count == 0)
            {
                // Any good search word: Exit without results.
                return(null);
            }

            return(synonimous);
        }
Пример #2
0
 public void StoreConfiguration(string language)
 {
     IndexCfg cfg = new IndexCfg(language);
     cfg.Insert(cnn);
 }
Пример #3
0
        public void StoreConfiguration(string language)
        {
            IndexCfg cfg = new IndexCfg(language);

            cfg.Insert(cnn);
        }