public virtual void AddBinaryUpdate(BinaryDocValuesUpdate update, int docIDUpto) { if (!binaryUpdates.TryGetValue(update.field, out LinkedDictionary <Term, BinaryDocValuesUpdate> fieldUpdates)) { fieldUpdates = new LinkedDictionary <Term, BinaryDocValuesUpdate>(); binaryUpdates[update.field] = fieldUpdates; bytesUsed.AddAndGet(BYTES_PER_BINARY_FIELD_ENTRY); } if (fieldUpdates.TryGetValue(update.term, out BinaryDocValuesUpdate current) && 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 LinkedHashMap, 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.GetSizeInBytes()); } }
internal virtual void Update(FrozenBufferedUpdates @in) { iterables.Add(@in.GetTermsEnumerable()); for (int queryIdx = 0; queryIdx < @in.queries.Length; queryIdx++) { Query query = @in.queries[queryIdx]; queries[query] = BufferedUpdates.MAX_INT32; } foreach (NumericDocValuesUpdate nu in @in.numericDVUpdates) { NumericDocValuesUpdate clone = new NumericDocValuesUpdate(nu.term, nu.field, (long?)nu.value); clone.docIDUpto = int.MaxValue; numericDVUpdates.Add(clone); } foreach (BinaryDocValuesUpdate bu in @in.binaryDVUpdates) { BinaryDocValuesUpdate clone = new BinaryDocValuesUpdate(bu.term, bu.field, (BytesRef)bu.value); clone.docIDUpto = int.MaxValue; binaryDVUpdates.Add(clone); } }
internal BinaryUpdateNode(BinaryDocValuesUpdate update) : base(update) { }
internal void AddBinaryUpdate(BinaryDocValuesUpdate update) { Add(new BinaryUpdateNode(update)); TryApplyGlobalSlice(); }