Esempio n. 1
0
 internal abstract void Flush(SegmentWriteState state, DocValuesConsumer consumer);
        internal override void Flush(SegmentWriteState state, DocValuesConsumer dvConsumer)
        {
            int maxDoc = state.SegmentInfo.DocCount;

            dvConsumer.AddNumericField(FieldInfo, GetNumericIterator(maxDoc));
        }
        internal override void Flush(SegmentWriteState state, DocValuesConsumer dvConsumer)
        {
            int maxDoc = state.SegmentInfo.DocCount;
            int maxCountPerDoc = MaxCount;
            Debug.Assert(PendingCounts.Size() == maxDoc);
            int valueCount = Hash.Size();

            int[] sortedValues = Hash.Sort(BytesRef.UTF8SortedAsUnicodeComparer);
            int[] ordMap = new int[valueCount];

            for (int ord = 0; ord < valueCount; ord++)
            {
                ordMap[sortedValues[ord]] = ord;
            }

            dvConsumer.AddSortedSetField(FieldInfo, GetBytesRefEnumberable(valueCount, sortedValues),

                                      // doc -> ordCount
                                      GetOrdsEnumberable(maxDoc),

                                      // ords
                                      GetOrdCountEnumberable(maxCountPerDoc, ordMap));
        }