public void Dispose() { if (_tdIndexWriter != null) { _tdIndexWriter.Dispose(); } if (TdIndexAnalyzer != null) { TdIndexAnalyzer.Dispose(); } if (TdIndexDirectory != null) { TdIndexDirectory.Dispose(); } }
public Task <bool> RemoveIndexAsync() { try { if (IndexLocation != "ram") { var directoryInfo = new DirectoryInfo(IndexLocation); Parallel.ForEach(directoryInfo.GetFiles(), file => file.Delete()); } else { TdIndexDirectory.Dispose(); } } // ReSharper disable once EmptyGeneralCatchClause catch { //TODO: log this somewhere } return(Task.FromResult(true)); }