internal BinaryUpdateNode(BinaryDocValuesUpdate update) : base(update) { }
public virtual void AddBinaryUpdate(BinaryDocValuesUpdate update, int docIDUpto) { OrderedDictionary fieldUpdates; if (!BinaryUpdates.TryGetValue(update.Field, out fieldUpdates)) { fieldUpdates = new OrderedDictionary(); BinaryUpdates[update.Field] = fieldUpdates; BytesUsed.AddAndGet(BYTES_PER_BINARY_FIELD_ENTRY); } BinaryDocValuesUpdate current = null; if (fieldUpdates.Contains(update.Term)) { current = fieldUpdates[update.Term] as BinaryDocValuesUpdate; } 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; NumBinaryUpdates.IncrementAndGet(); if (current == null) { BytesUsed.AddAndGet(BYTES_PER_BINARY_UPDATE_ENTRY + update.SizeInBytes()); } }
internal void AddBinaryUpdate(BinaryDocValuesUpdate update) { Add(new BinaryUpdateNode(update)); TryApplyGlobalSlice(); }