예제 #1
0
        /// <summary>
        /// Adds a new <<fieldNumber, termBytes>, TermInfo> pair to the set.
        ///  Term must be lexicographically greater than all previous Terms added.
        ///  TermInfo pointers must be positive and greater than all previous.
        /// </summary>
        public void Add(int fieldNumber, BytesRef term, TermInfo ti)
        {
            Debug.Assert(CompareToLastTerm(fieldNumber, term) < 0 || (IsIndex && term.Length == 0 && LastTerm.Length == 0), "Terms are out of order: field=" + FieldName(FieldInfos, fieldNumber) + " (number " + fieldNumber + ")" + " lastField=" + FieldName(FieldInfos, LastFieldNumber) + " (number " + LastFieldNumber + ")" + " text=" + term.Utf8ToString() + " lastText=" + LastTerm.Utf8ToString());

            Debug.Assert(ti.FreqPointer >= LastTi.FreqPointer, "freqPointer out of order (" + ti.FreqPointer + " < " + LastTi.FreqPointer + ")");
            Debug.Assert(ti.ProxPointer >= LastTi.ProxPointer, "proxPointer out of order (" + ti.ProxPointer + " < " + LastTi.ProxPointer + ")");

            if (!IsIndex && Size % IndexInterval == 0)
            {
                Other.Add(LastFieldNumber, LastTerm, LastTi);        // add an index term
            }
            WriteTerm(fieldNumber, term);                            // write term

            Output.WriteVInt32(ti.DocFreq);                          // write doc freq
            Output.WriteVInt64(ti.FreqPointer - LastTi.FreqPointer); // write pointers
            Output.WriteVInt64(ti.ProxPointer - LastTi.ProxPointer);

            if (ti.DocFreq >= SkipInterval)
            {
                Output.WriteVInt32(ti.SkipOffset);
            }

            if (IsIndex)
            {
                Output.WriteVInt64(Other.Output.GetFilePointer() - LastIndexPointer);
                LastIndexPointer = Other.Output.GetFilePointer(); // write pointer
            }

            LastFieldNumber = fieldNumber;
            LastTi.Set(ti);
            Size++;
        }
예제 #2
0
        /// <summary>
        /// Adds a new &lt;&lt; <paramref name="fieldNumber"/>, termBytes&gt;, <see cref="TermInfo"/>&gt; pair to the set.
        /// Term must be lexicographically greater than all previous Terms added.
        /// <see cref="TermInfo"/> pointers must be positive and greater than all previous.
        /// </summary>
        public void Add(int fieldNumber, BytesRef term, TermInfo ti)
        {
            Debug.Assert(CompareToLastTerm(fieldNumber, term) < 0 || (isIndex && term.Length == 0 && lastTerm.Length == 0), "Terms are out of order: field=" + FieldName(fieldInfos, fieldNumber) + " (number " + fieldNumber + ")" + " lastField=" + FieldName(fieldInfos, lastFieldNumber) + " (number " + lastFieldNumber + ")" + " text=" + term.Utf8ToString() + " lastText=" + lastTerm.Utf8ToString());

            Debug.Assert(ti.FreqPointer >= lastTi.FreqPointer, "freqPointer out of order (" + ti.FreqPointer + " < " + lastTi.FreqPointer + ")");
            Debug.Assert(ti.ProxPointer >= lastTi.ProxPointer, "proxPointer out of order (" + ti.ProxPointer + " < " + lastTi.ProxPointer + ")");

            if (!isIndex && size % indexInterval == 0)
            {
                other.Add(lastFieldNumber, lastTerm, lastTi);        // add an index term
            }
            WriteTerm(fieldNumber, term);                            // write term

            output.WriteVInt32(ti.DocFreq);                          // write doc freq
            output.WriteVInt64(ti.FreqPointer - lastTi.FreqPointer); // write pointers
            output.WriteVInt64(ti.ProxPointer - lastTi.ProxPointer);

            if (ti.DocFreq >= skipInterval)
            {
                output.WriteVInt32(ti.SkipOffset);
            }

            if (isIndex)
            {
                output.WriteVInt64(other.output.GetFilePointer() - lastIndexPointer);
                lastIndexPointer = other.output.GetFilePointer(); // write pointer
            }

            lastFieldNumber = fieldNumber;
            lastTi.Set(ti);
            size++;
        }
예제 #3
0
 internal void Seek(long pointer, long p, Term t, TermInfo ti)
 {
     input.Seek(pointer);
     position = p;
     termBuffer.Set(t);
     prevBuffer.Reset();
     //System.out.println("  ste doSeek prev=" + prevBuffer.toTerm() + " this=" + this);
     termInfo.Set(ti);
     first = p == -1;
 }
예제 #4
0
 internal void Seek(long pointer, long p, Term t, TermInfo ti)
 {
     Input.Seek(pointer);
     Position = p;
     TermBuffer.Set(t);
     PrevBuffer.Reset();
     //System.out.println("  ste doSeek prev=" + prevBuffer.toTerm() + " this=" + this);
     TermInfo_Renamed.Set(ti);
     First = p == -1;
 }
예제 #5
0
        /// <summary>
        /// Adds a new &lt;&lt; <paramref name="fieldNumber"/>, termBytes&gt;, <see cref="TermInfo"/>&gt; pair to the set.
        /// Term must be lexicographically greater than all previous Terms added.
        /// <see cref="TermInfo"/> pointers must be positive and greater than all previous.
        /// </summary>
        public void Add(int fieldNumber, BytesRef term, TermInfo ti)
        {
            if (Debugging.AssertsEnabled)
            {
                Debugging.Assert(CompareToLastTerm(fieldNumber, term) < 0 || (isIndex && term.Length == 0 && lastTerm.Length == 0),
                                 "Terms are out of order: field={0} (number {1}) lastField={2} (number {3}) text={4} lastText={5}",
                                 FieldName(fieldInfos, fieldNumber), fieldNumber, FieldName(fieldInfos, lastFieldNumber), lastFieldNumber,
                                 // LUCENENET specific - use wrapper BytesRefFormatter struct to defer building the string unless string.Format() is called
                                 new BytesRefFormatter(term, BytesRefFormat.UTF8), new BytesRefFormatter(lastTerm, BytesRefFormat.UTF8));

                Debugging.Assert(ti.FreqPointer >= lastTi.FreqPointer, "freqPointer out of order ({0} < {1})", ti.FreqPointer, lastTi.FreqPointer);
                Debugging.Assert(ti.ProxPointer >= lastTi.ProxPointer, "proxPointer out of order ({0} < {1})", ti.ProxPointer, lastTi.ProxPointer);
            }

            if (!isIndex && size % indexInterval == 0)
            {
                other.Add(lastFieldNumber, lastTerm, lastTi);        // add an index term
            }
            WriteTerm(fieldNumber, term);                            // write term

            output.WriteVInt32(ti.DocFreq);                          // write doc freq
            output.WriteVInt64(ti.FreqPointer - lastTi.FreqPointer); // write pointers
            output.WriteVInt64(ti.ProxPointer - lastTi.ProxPointer);

            if (ti.DocFreq >= skipInterval)
            {
                output.WriteVInt32(ti.SkipOffset);
            }

            if (isIndex)
            {
                output.WriteVInt64(other.output.Position - lastIndexPointer); // LUCENENET specific: Renamed from getFilePointer() to match FileStream
                lastIndexPointer = other.output.Position;                     // write pointer // LUCENENET specific: Renamed from getFilePointer() to match FileStream
            }

            lastFieldNumber = fieldNumber;
            lastTi.Set(ti);
            size++;
        }
예제 #6
0
 /// <summary>
 /// Sets the argument to the current <see cref="Lucene3x.TermInfo"/> in the enumeration.
 /// Initially invalid, valid after <see cref="Next()"/> called for the first time.
 /// </summary>
 internal void TermInfo(TermInfo ti)
 {
     ti.Set(termInfo);
 }
예제 #7
0
 /// <summary>
 /// Sets the argument to the current TermInfo in the enumeration.
 /// Initially invalid, valid after next() called for the first time.
 /// </summary>
 internal void TermInfo(TermInfo ti)
 {
     ti.Set(TermInfo_Renamed);
 }
예제 #8
0
 /// <summary>
 /// Sets the argument to the current TermInfo in the enumeration.
 /// Initially invalid, valid after next() called for the first time.
 /// </summary>
 internal void TermInfo(TermInfo ti)
 {
     ti.Set(TermInfo_Renamed);
 }