SpellChecker.Net.Search.Spell.SpellChecker.SwapSearcher C# (CSharp) Метод

SwapSearcher() приватный Метод

private SwapSearcher ( Lucene.Net.Store.Directory dir ) : void
dir Lucene.Net.Store.Directory
Результат void
        private void SwapSearcher(Directory dir)
        {
            /*
             * opening a searcher is possibly very expensive.
             * We rather close it again if the Spellchecker was closed during
             * this operation than block access to the current searcher while opening.
             */
            IndexSearcher indexSearcher = CreateSearcher(dir);
            lock (searcherLock)
            {
                if (closed)
                {
                    indexSearcher.Close();
                    throw new AlreadyClosedException("Spellchecker has been closed");
                }
                if (searcher != null)
                {
                    searcher.Close();
                }
                // set the spellindex in the sync block - ensure consistency.
                searcher = indexSearcher;
                this.spellindex = dir;
            }
        }