コード例 #1
0
        internal virtual void SeekEnum(SegmentTermEnum enumerator, int indexOffset)
        {
            PagedBytesDataInput input = (PagedBytesDataInput)dataInput.Clone();

            input.SetPosition(indexToDataOffset.Get(indexOffset));

            // read the term
            int  fieldId = input.ReadVInt32();
            Term field   = fields[fieldId];
            Term term    = new Term(field.Field, input.ReadString());

            // read the terminfo
            var termInfo = new TermInfo();

            termInfo.DocFreq = input.ReadVInt32();
            if (termInfo.DocFreq >= skipInterval)
            {
                termInfo.SkipOffset = input.ReadVInt32();
            }
            else
            {
                termInfo.SkipOffset = 0;
            }
            termInfo.FreqPointer = input.ReadVInt64();
            termInfo.ProxPointer = input.ReadVInt64();

            long pointer = input.ReadVInt64();

            // perform the seek
            enumerator.Seek(pointer, ((long)indexOffset * totalIndexInterval) - 1, term, termInfo);
        }
コード例 #2
0
        /// <summary>
        /// Gets the term at the given position.  For testing.
        /// </summary>
        /// <param name="termIndex">
        ///          The position to read the term from the index. </param>
        /// <returns> The term. </returns>
        /// <exception cref="IOException"> If there is a low-level I/O error. </exception>
        internal virtual Term GetTerm(int termIndex)
        {
            PagedBytesDataInput input = (PagedBytesDataInput)dataInput.Clone();

            input.SetPosition(indexToDataOffset.Get(termIndex));

            // read the term
            int  fieldId = input.ReadVInt32();
            Term field   = fields[fieldId];

            return(new Term(field.Field, input.ReadString()));
        }
コード例 #3
0
        /// <summary>
        /// Gets the term at the given position.  For testing.
        /// </summary>
        /// <param name="termIndex">
        ///          the position to read the term from the index. </param>
        /// <returns> the term. </returns>
        /// <exception cref="IOException"> If there is a low-level I/O error. </exception>
        public virtual Term GetTerm(int termIndex)
        {
            PagedBytesDataInput input = (PagedBytesDataInput)DataInput.Clone();

            input.Position = IndexToDataOffset.Get(termIndex);

            // read the term
            int  fieldId = input.ReadVInt();
            Term field   = Fields[fieldId];

            return(new Term(field.Field, input.ReadString()));
        }