Пример #1
0
        public virtual void AddValue(int docID, BytesRef value)
        {
            if (value == null)
            {
                throw new System.ArgumentException("field \"" + FieldInfo.Name + "\": null value not allowed");
            }
            if (value.Length > (ByteBlockPool.BYTE_BLOCK_SIZE - 2))
            {
                throw new System.ArgumentException("DocValuesField \"" + FieldInfo.Name + "\" is too large, must be <= " + (ByteBlockPool.BYTE_BLOCK_SIZE - 2));
            }

            if (docID != CurrentDoc)
            {
                FinishCurrentDoc();
            }

            // Fill in any holes:
            while (CurrentDoc < docID)
            {
                PendingCounts.Add(0); // no values
                CurrentDoc++;
            }

            AddOneValue(value);
            UpdateBytesUsed();
        }
Пример #2
0
        public virtual void AddValue(int docID, long value)
        {
            if (docID < Pending.Size())
            {
                throw new System.ArgumentException("DocValuesField \"" + FieldInfo.Name + "\" appears more than once in this document (only one value is allowed per field)");
            }

            // Fill in any holes:
            for (int i = (int)Pending.Size(); i < docID; ++i)
            {
                Pending.Add(MISSING);
            }

            Pending.Add(value);
            if (DocsWithField != null)
            {
                DocsWithField = FixedBitSet.EnsureCapacity(DocsWithField, docID);
                DocsWithField.Set(docID);
            }

            UpdateBytesUsed();
        }
Пример #3
0
        public virtual void AddValue(int docID, BytesRef value)
        {
            if (docID < Pending.Size())
            {
                throw new System.ArgumentException("DocValuesField \"" + FieldInfo.Name + "\" appears more than once in this document (only one value is allowed per field)");
            }
            if (value == null)
            {
                throw new System.ArgumentException("field \"" + FieldInfo.Name + "\": null value not allowed");
            }
            if (value.Length > (ByteBlockPool.BYTE_BLOCK_SIZE - 2))
            {
                throw new System.ArgumentException("DocValuesField \"" + FieldInfo.Name + "\" is too large, must be <= " + (ByteBlockPool.BYTE_BLOCK_SIZE - 2));
            }

            // Fill in any holes:
            while (Pending.Size() < docID)
            {
                Pending.Add(EMPTY_ORD);
            }

            AddOneValue(value);
        }
Пример #4
0
        public virtual void AddValue(int docID, BytesRef value)
        {
            if (docID < AddedValues)
            {
                throw new System.ArgumentException("DocValuesField \"" + FieldInfo.Name + "\" appears more than once in this document (only one value is allowed per field)");
            }
            if (value == null)
            {
                throw new System.ArgumentException("field=\"" + FieldInfo.Name + "\": null value not allowed");
            }
            if (value.Length > MAX_LENGTH)
            {
                throw new System.ArgumentException("DocValuesField \"" + FieldInfo.Name + "\" is too large, must be <= " + MAX_LENGTH);
            }

            // Fill in any holes:
            while (AddedValues < docID)
            {
                AddedValues++;
                Lengths.Add(0);
            }
            AddedValues++;
            Lengths.Add(value.Length);
            try
            {
                BytesOut.WriteBytes(value.Bytes, value.Offset, value.Length);
            }
            catch (System.IO.IOException ioe)
            {
                // Should never happen!
                throw new Exception(ioe.Message, ioe);
            }
            DocsWithField = FixedBitSet.EnsureCapacity(DocsWithField, docID);
            DocsWithField.Set(docID);
            UpdateBytesUsed();
        }