示例#1
0
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         // dispose managed resources
         searcher.Dispose();
         writer.Dispose();
         analyzer.Dispose();
         luceneIndexDirectory.Dispose();
     }
     // free native resources
 }
示例#2
0
        /// <summary>
        /// Dispose of this object.
        /// </summary>
        public void Dispose()
        {
            if (_writer != null)
            {
                _writer.Optimize();
                _writer.Flush(true, true, true);
                _writer.Dispose();
            }

            if (_searcher != null)
            {
                _searcher.Dispose();
            }

            if (_analyzer != null)
            {
                _analyzer.Dispose();
            }

            if (_directory != null)
            {
                _directory.Dispose();
            }
        }