// private readonly ILoggingService _loggingService; public ExamineIndexRepository(ExamineConfig examineConfig, IExamineManager examineManager, IConfiguration configuration // , ILoggingService loggingService ) { _examineConfig = examineConfig; _examineManager = examineManager; _configuration = configuration; // _loggingService = loggingService; DirectoryFactory.DefaultLockFactory = d => { var simpleFsLockFactory = new NoPrefixSimpleFsLockFactory(d); return(simpleFsLockFactory); }; foreach (var luceneIndexer in examineManager.Indexes.OfType <ExamineIndex>()) { // loggingService.Info("Forcing index {IndexerName} to be unlocked since it was left in a locked state", luceneIndexer.Name); var dir = luceneIndexer.GetLuceneDirectory(); if (!string.IsNullOrEmpty(dir.GetLockID())) { dir.ClearLock("write.lock"); } if (IndexWriter.IsLocked(dir)) { IndexWriter.Unlock(dir); } } }
public ExamineModule(ExamineConfig config) { Config = config; }