Пример #1
0
 internal void  Seek(long pointer, int p, Term t, TermInfo ti)
 {
     input.Seek(pointer);
     position = p;
     termBuffer.Set(t);
     prevBuffer.Reset();
     termInfo.Set(ti);
 }
Пример #2
0
 internal void  Seek(long pointer, long p, Term t, TermInfo ti, IState state)
 {
     input.Seek(pointer, state);
     position = p;
     termBuffer.Set(t);
     prevBuffer.Reset();
     termInfo.Set(ti);
 }
Пример #3
0
        /// <summary>Increments the enumeration to the next element.  True if one exists.</summary>
        public override bool Next()
        {
            if (position++ >= size - 1)
            {
                prevBuffer.Set(termBuffer);
                termBuffer.Reset();
                return(false);
            }

            prevBuffer.Set(termBuffer);
            termBuffer.Read(input, fieldInfos);

            termInfo.docFreq      = input.ReadVInt();        // read doc freq
            termInfo.freqPointer += input.ReadVLong();       // read freq pointer
            termInfo.proxPointer += input.ReadVLong();       // read prox pointer

            if (format == -1)
            {
                //  just read skipOffset in order to increment  file pointer;
                // value is never used since skipTo is switched off
                if (!isIndex)
                {
                    if (termInfo.docFreq > formatM1SkipInterval)
                    {
                        termInfo.skipOffset = input.ReadVInt();
                    }
                }
            }
            else
            {
                if (termInfo.docFreq >= skipInterval)
                {
                    termInfo.skipOffset = input.ReadVInt();
                }
            }

            if (isIndex)
            {
                indexPointer += input.ReadVLong();                 // read index pointer
            }
            return(true);
        }
Пример #4
0
        /// <summary>Optimized scan, without allocating new terms.  Return numver of invocations to Next(). </summary>
        internal int ScanTo(Term term)
        {
            scanBuffer.Set(term);
            int count = 0;

            while (scanBuffer.CompareTo(termBuffer) > 0 && Next())
            {
                count++;
            }
            return(count);
        }
Пример #5
0
 /// <summary>Optimized scan, without allocating new terms. </summary>
 internal void  ScanTo(Term term)
 {
     if (scratch == null)
     {
         scratch = new TermBuffer();
     }
     scratch.Set(term);
     while (scratch.CompareTo(termBuffer) > 0 && Next())
     {
     }
 }