Beispiel #1
0
        /**
         * Do a bulk copy of numDocs documents from reader to our
         * streams.  This is used to expedite merging, if the
         * field numbers are congruent.
         */
        internal void AddRawDocuments(TermVectorsReader reader, int[] tvdLengths, int[] tvfLengths, int numDocs)
        {
            long tvdPosition = tvd.GetFilePointer();
            long tvfPosition = tvf.GetFilePointer();
            long tvdStart    = tvdPosition;
            long tvfStart    = tvfPosition;

            for (int i = 0; i < numDocs; i++)
            {
                tvx.WriteLong(tvdPosition);
                tvdPosition += tvdLengths[i];
                tvx.WriteLong(tvfPosition);
                tvfPosition += tvfLengths[i];
            }
            tvd.CopyBytes(reader.GetTvdStream(), tvdPosition - tvdStart);
            tvf.CopyBytes(reader.GetTvfStream(), tvfPosition - tvfStart);
            System.Diagnostics.Debug.Assert(tvd.GetFilePointer() == tvdPosition);
            System.Diagnostics.Debug.Assert(tvf.GetFilePointer() == tvfPosition);
        }
 /// <summary> Do a bulk copy of numDocs documents from reader to our
 /// streams.  This is used to expedite merging, if the
 /// field numbers are congruent.
 /// </summary>
 internal void AddRawDocuments(TermVectorsReader reader, int[] tvdLengths, int[] tvfLengths, int numDocs)
 {
     long tvdPosition = tvd.GetFilePointer();
     long tvfPosition = tvf.GetFilePointer();
     long tvdStart = tvdPosition;
     long tvfStart = tvfPosition;
     for (int i = 0; i < numDocs; i++)
     {
         tvx.WriteLong(tvdPosition);
         tvdPosition += tvdLengths[i];
         tvx.WriteLong(tvfPosition);
         tvfPosition += tvfLengths[i];
     }
     tvd.CopyBytes(reader.GetTvdStream(), tvdPosition - tvdStart);
     tvf.CopyBytes(reader.GetTvfStream(), tvfPosition - tvfStart);
     System.Diagnostics.Debug.Assert(tvd.GetFilePointer() == tvdPosition);
     System.Diagnostics.Debug.Assert(tvf.GetFilePointer() == tvfPosition);
 }