internal override void Flush(ICollection <object> threads, DocumentsWriter.FlushState state)
        {
            IDictionary <object, ICollection <object> > childThreadsAndFields = new Dictionary <object, ICollection <object> >();
            IEnumerator <object> it = threads.GetEnumerator();

            while (it.MoveNext())
            {
                DocFieldProcessorPerThread perThread = (DocFieldProcessorPerThread)it.Current;
                childThreadsAndFields[perThread.consumer] = perThread.Fields();
                perThread.trimFields(state);
            }

            consumer.flush(childThreadsAndFields, state);

            // Important to save after asking consumer to flush so
            // consumer can alter the FieldInfo* if necessary.  EG,
            // FreqProxTermsWriter does this with
            // FieldInfo.storePayload.
            fieldInfos.Write(state.directory, state.segmentName + ".fnm");
        }