Lucene.Net.Codecs.Lucene3x.TermBuffer.Read C# (CSharp) Method

Read() public method

public Read ( IndexInput input, FieldInfos fieldInfos ) : void
input IndexInput
fieldInfos FieldInfos
return void
        public void Read(IndexInput input, FieldInfos fieldInfos)
        {
            this.Term = null; // invalidate cache
            NewSuffixStart = input.ReadVInt();
            int length = input.ReadVInt();
            int totalLength = NewSuffixStart + length;
            Debug.Assert(totalLength <= ByteBlockPool.BYTE_BLOCK_SIZE - 2, "termLength=" + totalLength + ",resource=" + input);
            if (Bytes.Bytes.Length < totalLength)
            {
                Bytes.Grow(totalLength);
            }
            Bytes.Length = totalLength;
            input.ReadBytes(Bytes.Bytes, NewSuffixStart, length);
            int fieldNumber = input.ReadVInt();
            if (fieldNumber != CurrentFieldNumber)
            {
                CurrentFieldNumber = fieldNumber;
                // NOTE: too much sneakiness here, seriously this is a negative vint?!
                if (CurrentFieldNumber == -1)
                {
                    Field = "";
                }
                else
                {
                    Debug.Assert(fieldInfos.FieldInfo(CurrentFieldNumber) != null, CurrentFieldNumber.ToString());
                    Field = String.Intern(fieldInfos.FieldInfo(CurrentFieldNumber).Name);
                }
            }
            else
            {
                Debug.Assert(Field.Equals(fieldInfos.FieldInfo(fieldNumber).Name), "currentFieldNumber=" + CurrentFieldNumber + " field=" + Field + " vs " + fieldInfos.FieldInfo(fieldNumber) == null ? "null" : fieldInfos.FieldInfo(fieldNumber).Name);
            }
        }

Usage Example

Example #1
0
        /// <summary>
        /// Increments the enumeration to the next element.  True if one exists. </summary>
        public bool Next()
        {
            prevBuffer.Set(termBuffer);
            //System.out.println("  ste setPrev=" + prev() + " this=" + this);

            if (position++ >= size - 1)
            {
                termBuffer.Reset();
                //System.out.println("    EOF");
                return(false);
            }

            termBuffer.Read(input, fieldInfos);
            newSuffixStart = termBuffer.newSuffixStart;

            termInfo.DocFreq      = input.ReadVInt32(); // read doc freq
            termInfo.FreqPointer += input.ReadVInt64(); // read freq pointer
            termInfo.ProxPointer += input.ReadVInt64(); // read prox pointer

            if (termInfo.DocFreq >= skipInterval)
            {
                termInfo.SkipOffset = input.ReadVInt32();
            }

            if (isIndex)
            {
                indexPointer += input.ReadVInt64(); // read index pointer
            }

            //System.out.println("  ste ret term=" + term());
            return(true);
        }
All Usage Examples Of Lucene.Net.Codecs.Lucene3x.TermBuffer::Read