protected internal override void CommitChanges() { if (deletedDocsDirty) { // re-write deleted si.AdvanceDelGen(); // We can write directly to the actual name (vs to a // .tmp & renaming it) because the file is not live // until segments file is written: deletedDocs.Write(Directory(), si.GetDelFileName()); si.SetDelCount(si.GetDelCount() + pendingDeleteCount); } if (undeleteAll && si.HasDeletions()) { si.ClearDelGen(); si.SetDelCount(0); } if (normsDirty) { // re-write norms si.SetNumFields(fieldInfos.Size()); System.Collections.IEnumerator it = norms.Values.GetEnumerator(); while (it.MoveNext()) { Norm norm = (Norm)it.Current; if (norm.dirty) { norm.ReWrite(si); } } } deletedDocsDirty = false; normsDirty = false; undeleteAll = false; }