internal NumericUpdateNode(NumericDocValuesUpdate update)
     : base(update)
 {
 }
Esempio n. 2
0
        public virtual void AddNumericUpdate(NumericDocValuesUpdate update, int docIDUpto)
        {
            OrderedDictionary fieldUpdates = null;
            if (!NumericUpdates.TryGetValue(update.Field, out fieldUpdates))
            {
                fieldUpdates = new OrderedDictionary();
                NumericUpdates[update.Field] = fieldUpdates;
                BytesUsed.AddAndGet(BYTES_PER_NUMERIC_FIELD_ENTRY);
            }

            NumericDocValuesUpdate current = null;
            if (fieldUpdates.Contains(update.Term))
            {
                current = fieldUpdates[update.Term] as NumericDocValuesUpdate;
            }

            if (current != null && docIDUpto < current.DocIDUpto)
            {
                // Only record the new number if it's greater than or equal to the current
                // one. this is important because if multiple threads are replacing the
                // same doc at nearly the same time, it's possible that one thread that
                // got a higher docID is scheduled before the other threads.
                return;
            }

            update.DocIDUpto = docIDUpto;
            // since it's an OrderedDictionary, we must first remove the Term entry so that
            // it's added last (we're interested in insertion-order).
            if (current != null)
            {
                fieldUpdates.Remove(update.Term);
            }
            fieldUpdates[update.Term] = update;
            NumNumericUpdates.IncrementAndGet();
            if (current == null)
            {
                BytesUsed.AddAndGet(BYTES_PER_NUMERIC_UPDATE_ENTRY + update.SizeInBytes());
            }
        }
 internal void AddNumericUpdate(NumericDocValuesUpdate update)
 {
     Add(new NumericUpdateNode(update));
     TryApplyGlobalSlice();
 }