예제 #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
        /// <summary>
        /// Open the index folders and call the DAO Search method
        /// </summary>
        /// <param name="searchQuery"></param>
        /// <param name="userId"></param>
        /// <param name="sortBy"></param>
        /// <returns></returns>
        private static List<IssueDocument> PerformSearch(Query searchQuery, int startIndex, int blockSize, string sortBy)
        {
            List<IssueDocument> result = null;
            string indexRootPath = ConfigurationController.IndexRootPath;
            Directory indexDirEs, indexDirEn, indexDirHe;

            try
            {
                indexDirEs = FSDirectory.Open(new System.IO.DirectoryInfo(indexRootPath + "/ES/IDX"));
                indexDirEn = FSDirectory.Open(new System.IO.DirectoryInfo(indexRootPath + "/EN/IDX"));
                indexDirHe = FSDirectory.Open(new System.IO.DirectoryInfo(indexRootPath + "/HE/IDX"));
            }
            catch
            {
                throw new ApplicationException("The index directory does not exist");
            }

            LuceneDao dao = new LuceneDao();

            result = dao.MedesSearch(searchQuery, startIndex, blockSize, indexDirEs, indexDirEn, indexDirHe, sortBy);

            return result;
        }
예제 #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;
        }