예제 #1
0
        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);
            }
        }
예제 #2
0
        public virtual void AddNumericUpdate(NumericDocValuesUpdate update, int docIDUpto)
        {
            LinkedHashMap <Term, NumericDocValuesUpdate> fieldUpdates = null;

            if (!numericUpdates.TryGetValue(update.field, out fieldUpdates))
            {
                fieldUpdates = new LinkedHashMap <Term, NumericDocValuesUpdate>();
                numericUpdates[update.field] = fieldUpdates;
                bytesUsed.AddAndGet(BYTES_PER_NUMERIC_FIELD_ENTRY);
            }

            NumericDocValuesUpdate current;

            if (fieldUpdates.TryGetValue(update.term, out 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;
            numNumericUpdates.IncrementAndGet();
            if (current == null)
            {
                bytesUsed.AddAndGet(BYTES_PER_NUMERIC_UPDATE_ENTRY + update.GetSizeInBytes());
            }
        }
예제 #3
0
        internal virtual void Update(FrozenBufferedUpdates @in)
        {
            Iterables.Add(@in.TermsIterable());

            for (int queryIdx = 0; queryIdx < @in.Queries.Length; queryIdx++)
            {
                Query query = @in.Queries[queryIdx];
                Queries[query] = BufferedUpdates.MAX_INT;
            }

            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 NumericUpdateNode(NumericDocValuesUpdate update)
     : base(update)
 {
 }
 internal void AddNumericUpdate(NumericDocValuesUpdate update)
 {
     Add(new NumericUpdateNode(update));
     TryApplyGlobalSlice();
 }