internal override void Flush(IDictionary <string, InvertedDocConsumerPerField> fieldsToFlush, SegmentWriteState state) { IDictionary <string, TermsHashConsumerPerField> childFields = new Dictionary <string, TermsHashConsumerPerField>(); IDictionary <string, InvertedDocConsumerPerField> nextChildFields; if (nextTermsHash != null) { nextChildFields = new Dictionary <string, InvertedDocConsumerPerField>(); } else { nextChildFields = null; } foreach (KeyValuePair <string, InvertedDocConsumerPerField> entry in fieldsToFlush) { TermsHashPerField perField = (TermsHashPerField)entry.Value; childFields[entry.Key] = perField.consumer; if (nextTermsHash != null) { nextChildFields[entry.Key] = perField.nextPerField; } } consumer.Flush(childFields, state); if (nextTermsHash != null) { nextTermsHash.Flush(nextChildFields, state); } }
internal override void Flush(IDictionary <InvertedDocConsumerPerThread, ICollection <InvertedDocConsumerPerField> > threadsAndFields, SegmentWriteState state) { lock (this) { var childThreadsAndFields = new Dictionary <TermsHashConsumerPerThread, ICollection <TermsHashConsumerPerField> >(); Dictionary <InvertedDocConsumerPerThread, ICollection <InvertedDocConsumerPerField> > nextThreadsAndFields; if (nextTermsHash != null) { nextThreadsAndFields = new Dictionary <InvertedDocConsumerPerThread, ICollection <InvertedDocConsumerPerField> >(); } else { nextThreadsAndFields = null; } foreach (var entry in threadsAndFields) { TermsHashPerThread perThread = (TermsHashPerThread)entry.Key; ICollection <InvertedDocConsumerPerField> fields = entry.Value; var fieldsIt = fields.GetEnumerator(); ICollection <TermsHashConsumerPerField> childFields = new HashSet <TermsHashConsumerPerField>(); ICollection <InvertedDocConsumerPerField> nextChildFields; if (nextTermsHash != null) { nextChildFields = new HashSet <InvertedDocConsumerPerField>(); } else { nextChildFields = null; } while (fieldsIt.MoveNext()) { TermsHashPerField perField = (TermsHashPerField)fieldsIt.Current; childFields.Add(perField.consumer); if (nextTermsHash != null) { nextChildFields.Add(perField.nextPerField); } } childThreadsAndFields[perThread.consumer] = childFields; if (nextTermsHash != null) { nextThreadsAndFields[perThread.nextPerThread] = nextChildFields; } } consumer.Flush(childThreadsAndFields, state); ShrinkFreePostings(threadsAndFields, state); if (nextTermsHash != null) { nextTermsHash.Flush(nextThreadsAndFields, state); } } }
internal override void Flush(System.Collections.IDictionary threadsAndFields, SegmentWriteState state) { lock (this) { System.Collections.IDictionary childThreadsAndFields = new System.Collections.Hashtable(); System.Collections.IDictionary nextThreadsAndFields; if (nextTermsHash != null) { nextThreadsAndFields = new System.Collections.Hashtable(); } else { nextThreadsAndFields = null; } System.Collections.IEnumerator it = new System.Collections.Hashtable(threadsAndFields).GetEnumerator(); while (it.MoveNext()) { System.Collections.DictionaryEntry entry = (System.Collections.DictionaryEntry)it.Current; TermsHashPerThread perThread = (TermsHashPerThread)entry.Key; System.Collections.ICollection fields = (System.Collections.ICollection)entry.Value; System.Collections.IEnumerator fieldsIt = fields.GetEnumerator(); System.Collections.Hashtable childFields = new System.Collections.Hashtable(); System.Collections.Hashtable nextChildFields; if (nextTermsHash != null) { nextChildFields = new System.Collections.Hashtable(); } else { nextChildFields = null; } while (fieldsIt.MoveNext()) { TermsHashPerField perField = (TermsHashPerField)((System.Collections.DictionaryEntry)fieldsIt.Current).Key; childFields[perField.consumer] = perField.consumer; if (nextTermsHash != null) { nextChildFields[perField.nextPerField] = perField.nextPerField; } } childThreadsAndFields[perThread.consumer] = childFields; if (nextTermsHash != null) { nextThreadsAndFields[perThread.nextPerThread] = nextChildFields; } } consumer.Flush(childThreadsAndFields, state); ShrinkFreePostings(threadsAndFields, state); if (nextTermsHash != null) { nextTermsHash.Flush(nextThreadsAndFields, state); } } }