text: public override void Build(IInputIterator iter){if (m_searcherMgr != null){m_searcherMgr.Dispose();m_searcherMgr = null;}if (writer != null){writer.Dispose();writer = null;}AtomicReader r = null;bool success = false;try{writer = new IndexWriter(dir, GetIndexWriterConfig(matchVersion, GramAnalyzer, OpenMode.CREATE));BytesRef text;while ((text = iter.Next()) != null){BytesRef payload;if (iter.HasPayloads){payload = iter.Payload;}else{payload = null;}Add(text, iter.Contexts, iter.Weight, payload);}m_searcherMgr = new SearcherManager(writer, true, null);success = true;}finally{if (success){IOUtils.Dispose(r);}else{IOUtils.DisposeWhileHandlingException(writer, r);writer = null;}}}