/// <summary>
 /// Compares the fields before checking the text of the terms.
 /// </summary>
 /// <param name="term">
 ///          the given term. </param>
 /// <param name="termIndex">
 ///          the term that exists in the data block. </param>
 /// <param name="input">
 ///          the data block. </param>
 /// <returns> int. </returns>
 /// <exception cref="IOException"> If there is a low-level I/O error. </exception>
 private int CompareField(Term term, int termIndex, PagedBytesDataInput input)
 {
     input.Position = IndexToDataOffset.Get(termIndex);
     return term.Field().CompareTo(Fields[input.ReadVInt()].Field());
 }
 /// <summary>
 /// Compare the fields of the terms first, and if not equals return from
 /// compare. If equal compare terms.
 /// </summary>
 /// <param name="term">
 ///          the term to compare. </param>
 /// <param name="termIndex">
 ///          the position of the term in the input to compare </param>
 /// <param name="input">
 ///          the input buffer. </param>
 /// <returns> int. </returns>
 /// <exception cref="IOException"> If there is a low-level I/O error. </exception>
 private int CompareTo(Term term, int termIndex, PagedBytesDataInput input, BytesRef reuse)
 {
     // if term field does not equal mid's field index, then compare fields
     // else if they are equal, compare term's string values...
     int c = CompareField(term, termIndex, input);
     if (c == 0)
     {
         reuse.Length = input.ReadVInt();
         reuse.Grow(reuse.Length);
         input.ReadBytes(reuse.Bytes, 0, reuse.Length);
         return Comparator.Compare(term.Bytes(), reuse);
     }
     return c;
 }