Example #1
0
        /// <summary>
        /// Bulk write a contiguous series of documents.  The
        /// <paramref name="lengths"/> array is the length (in bytes) of each raw
        /// document.  The <paramref name="stream"/> <see cref="IndexInput"/> is the
        /// fieldsStream from which we should bulk-copy all
        /// bytes.
        /// </summary>
        public void AddRawDocuments(IndexInput stream, int[] lengths, int numDocs)
        {
            long position = fieldsStream.GetFilePointer();
            long start    = position;

            for (int i = 0; i < numDocs; i++)
            {
                indexStream.WriteInt64(position);
                position += lengths[i];
            }
            fieldsStream.CopyBytes(stream, position - start);
            Debug.Assert(fieldsStream.GetFilePointer() == position);
        }
Example #2
0
        /// <summary>
        /// Bulk write a contiguous series of documents.  The
        ///  lengths array is the length (in bytes) of each raw
        ///  document.  The stream IndexInput is the
        ///  fieldsStream from which we should bulk-copy all
        ///  bytes.
        /// </summary>
        public void AddRawDocuments(IndexInput stream, int[] lengths, int numDocs)
        {
            long position = FieldsStream.FilePointer;
            long start    = position;

            for (int i = 0; i < numDocs; i++)
            {
                IndexStream.WriteLong(position);
                position += lengths[i];
            }
            FieldsStream.CopyBytes(stream, position - start);
            Debug.Assert(FieldsStream.FilePointer == position);
        }
Example #3
0
        /// <summary>Bulk write a contiguous series of documents.  The
        /// lengths array is the length (in bytes) of each raw
        /// document.  The stream IndexInput is the
        /// fieldsStream from which we should bulk-copy all
        /// bytes.
        /// </summary>
        internal void  AddRawDocuments(IndexInput stream, int[] lengths, int numDocs)
        {
            long position = fieldsStream.FilePointer;
            long start    = position;

            for (int i = 0; i < numDocs; i++)
            {
                indexStream.WriteLong(position);
                position += lengths[i];
            }
            fieldsStream.CopyBytes(stream, position - start);
            System.Diagnostics.Debug.Assert(fieldsStream.FilePointer == position);
        }
Example #4
0
        /// <summary>
        /// Bulk write a contiguous series of documents.  The
        /// <paramref name="lengths"/> array is the length (in bytes) of each raw
        /// document.  The <paramref name="stream"/> <see cref="IndexInput"/> is the
        /// fieldsStream from which we should bulk-copy all
        /// bytes.
        /// </summary>
        public void AddRawDocuments(IndexInput stream, int[] lengths, int numDocs)
        {
            long position = fieldsStream.Position; // LUCENENET specific: Renamed from getFilePointer() to match FileStream
            long start    = position;

            for (int i = 0; i < numDocs; i++)
            {
                indexStream.WriteInt64(position);
                position += lengths[i];
            }
            fieldsStream.CopyBytes(stream, position - start);
            if (Debugging.AssertsEnabled)
            {
                Debugging.Assert(fieldsStream.Position == position);                           // LUCENENET specific: Renamed from getFilePointer() to match FileStream
            }
        }
Example #5
0
        /// <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.FilePointer;
            long tvfPosition = tvf.FilePointer;
            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.FilePointer == tvdPosition);
            System.Diagnostics.Debug.Assert(tvf.FilePointer == tvfPosition);
        }
 public override void CopyBytes(DataInput input, long numBytes)
 {
     @delegate.CopyBytes(input, numBytes);
 }