/// <summary> /// This method creates the NCacheDirectory and IndexWriter /// </summary> private void InitializeLucene() { _indexName = ConfigurationManager.AppSettings["IndexName"]; _cacheID = ConfigurationManager.AppSettings["CacheID"]; _luceneIndexDirectory = NCacheDirectory.Open(_cacheID, _indexName); _writer = new IndexWriter(_luceneIndexDirectory, new IndexWriterConfig(LuceneVersion.LUCENE_48, _analyzer)); Console.WriteLine($"NCacheDirectory and IndexWriter opened with cache name: [{_cacheID}], and index name: [{_indexName}]"); }
public FTSBase(AppSettings appSettings) { analyzer = new StandardAnalyzer(this.Version); //analyzer = new Lucene.Net.Analysis.En.EnglishAnalyzer(this.Version); //indexDirectory = FSDirectory.Open(new DirectoryInfo(appSettings.IndexPath)); indexDirectory = NCacheDirectory.Open(appSettings.LuceneCacheName, appSettings.IndexPath); //--- Create the configuration for IndexWriter indexWriterConfig = new IndexWriterConfig(this.Version, analyzer); if (indexWriter == null) { indexWriter = new IndexWriter(indexDirectory, indexWriterConfig); } }