Beispiel #1
0
 public void Dispose()
 {
     analyzer.Close();
     if (currentIndexSearcherHolder != null)
     {
         currentIndexSearcherHolder.SetIndexSearcher(null);
     }
     writer.Dispose();
     directory.Dispose();
 }
Beispiel #2
0
        public void ForceIndexReset()
        {
            try
            {
                if (analyzer != null)
                {
                    analyzer.Close();
                }
                if (currentIndexSearcherHolder != null)
                {
                    currentIndexSearcherHolder.SetIndexSearcher(null);
                }

                SafeDispose(crashMarker);
                SafeDispose(writer);
                SafeDispose(directory);

                IOExtensions.DeleteDirectory(indexDirectory);
            }
            finally
            {
                OpenIndexOnStartup();
            }
        }
Beispiel #3
0
        public void Dispose()
        {
            var exceptionAggregator = new ExceptionAggregator(log, string.Format("Could not properly close index storage for file system '{0}'", this.name));

            exceptionAggregator.Execute(() => { if (analyzer != null)
                                                {
                                                    analyzer.Close();
                                                }
                                        });
            exceptionAggregator.Execute(() => { if (currentIndexSearcherHolder != null)
                                                {
                                                    currentIndexSearcherHolder.SetIndexSearcher(null);
                                                }
                                        });
            exceptionAggregator.Execute(() => SafeDispose(crashMarker));
            exceptionAggregator.Execute(() => SafeDispose(writer));
            exceptionAggregator.Execute(() => SafeDispose(directory));

            exceptionAggregator.ThrowIfNeeded();
        }