public long Write() { if (_flushed) { return(WriteSession.Version.Version); } var docTimer = Stopwatch.StartNew(); var count = 0; foreach (var doc in _documents.ReadSource()) { doc.TableId = count++; DocumentWriteCommand.Write(doc, WriteSession); } WriteSession.Version.DocumentCount = count; Log.InfoFormat("analyzed {0} documents in {1}", count, docTimer.Elapsed); WriteSession.Flush(); _flushed = true; return(WriteSession.Version.Version); }
public void Commit() { if (_committed) { return; } _writeSession.Flush(); _postingsWriter.Dispose(); _compoundFile.Dispose(); _writeSession.Dispose(); var fileName = Path.Combine(_directory, _ix.VersionId + ".ix"); _ix.Serialize(fileName); _committed = true; }