Exemplo n.º 1
0
        private static void MoveLuceneIndex(String lng, int indexServer)
        {
            T.TraceMessage("Moving lucene index to server {0}", indexServer);

            Directory[] readers = new Directory[1];
            string impDomain = string.Empty, impUser = string.Empty, impPass = string.Empty;
            string destIndexBasePath = string.Empty;

            if (indexServer == 1)
            {
                destIndexBasePath = ConfigurationController.IndexRootPath;
            }

            Analyzer analyzer = new SpanishAnalyzer(ConfigurationController.Stop_Words);
            string destIndexPath = destIndexBasePath + "\\ES\\IDX";
            string tempIndexPath = ConfigurationController.TempIndexRootPath + "/ES/IDX";

            if (lng.ToLower().Trim().Equals("en"))
            {
                destIndexPath = destIndexBasePath + "\\EN\\IDX";
                tempIndexPath = ConfigurationController.TempIndexRootPath + "/EN/IDX";
                analyzer = new EnglishAnalyzer(ConfigurationController.Stop_Words);
            }
            if (lng.ToLower().Trim().Equals("he"))
            {
                destIndexPath = destIndexBasePath + "\\HE\\IDX";
                tempIndexPath = ConfigurationController.TempIndexRootPath + "/HE/IDX";
                analyzer = new MorphAnalyzer(ConfigurationController.MorphFilesPath);
            }

            MoveIndexFiles(impDomain, impUser, impPass, destIndexPath, tempIndexPath, analyzer);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Update Index by Language
        /// </summary>
        /// <param name="indexDir"></param>
        /// <param name="lng"></param>
        /// <returns></returns>
        public static void UpdateIndex(String lng)
        {
            Analyzer analyzer = new SpanishAnalyzer(ConfigurationController.Stop_Words);

            Directory indexDir = FSDirectory.Open(new System.IO.DirectoryInfo(ConfigurationController.TempIndexRootPath + "/ES/IDX"));
            if (lng.ToLower().Trim().Equals("en"))
            {
                indexDir = FSDirectory.Open(new System.IO.DirectoryInfo(ConfigurationController.TempIndexRootPath + "/EN/IDX"));
                analyzer = new EnglishAnalyzer(ConfigurationController.Stop_Words);
            }
            if (lng.ToLower().Trim().Equals("he"))
            {
                indexDir = FSDirectory.Open(new System.IO.DirectoryInfo(ConfigurationController.TempIndexRootPath + "/HE/IDX"));
                analyzer = new MorphAnalyzer(ConfigurationController.MorphFilesPath);
            }

            LuceneDao dao = new LuceneDao();
            dao.Analizer = analyzer;

            dao.UpdateIndex(indexDir, lng);
        }