コード例 #1
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);
        }
コード例 #2
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);
        }
コード例 #3
0
        /// <summary>
        /// Indexing a single publication, passed as parameter
        /// </summary>
        /// <param name="bean"></param>
        /// <param name="lng"></param>
        /// <returns></returns>
        public static int IndexPublication(IssueDocumentDto bean, string lng)
        {
            Analyzer analyzer = new SpanishAnalyzer(ConfigurationController.Stop_Words);

            if (!string.IsNullOrEmpty(ConfigurationController.IndexRootPath))
            {
                Directory indexDir = FSDirectory.Open(new System.IO.DirectoryInfo(ConfigurationController.IndexRootPath + "/ES/IDX"));
                if (!lng.ToLower().Trim().Equals("es"))
                    indexDir = FSDirectory.Open(new System.IO.DirectoryInfo(ConfigurationController.IndexRootPath + "/EN/IDX"));

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

                return dao.IndexPublication(indexDir, bean);

            }

            return -1;
        }