// we don't actually write a .tvx-like index, instead we read the
        // vectors file in entirety up-front and save the offsets
        // so we can seek to the data later.
        private void ReadIndex(int maxDoc)
        {
            ChecksumIndexInput input = new BufferedChecksumIndexInput(_input);

            _offsets = new long[maxDoc];
            int upto = 0;

            while (!_scratch.Equals(END))
            {
                SimpleTextUtil.ReadLine(input, _scratch);
                if (StringHelper.StartsWith(_scratch, DOC))
                {
                    _offsets[upto] = input.FilePointer;
                    upto++;
                }
            }
            SimpleTextUtil.CheckFooter(input);
            Debug.Assert(upto == _offsets.Length);
        }
Ejemplo n.º 2
0
        /// <remarks>
        /// we don't actually write a .fdx-like index, instead we read the
        /// stored fields file in entirety up-front and save the offsets
        /// so we can seek to the documents later.
        /// </remarks>
        private void ReadIndex(int size)
        {
            ChecksumIndexInput input = new BufferedChecksumIndexInput(_input);

            _offsets = new long[size];
            var upto = 0;

            while (!_scratch.Equals(SimpleTextStoredFieldsWriter.END))
            {
                SimpleTextUtil.ReadLine(input, _scratch);
                if (StringHelper.StartsWith(_scratch, SimpleTextStoredFieldsWriter.DOC))
                {
                    _offsets[upto] = input.FilePointer;
                    upto++;
                }
            }
            SimpleTextUtil.CheckFooter(input);
            Debug.Assert(upto == _offsets.Length);
        }
Ejemplo n.º 3
0
        public override void CheckIntegrity()
        {
            var iScratch = new BytesRef();
            var clone    = (IndexInput)DATA.Clone();

            clone.Seek(0);
            ChecksumIndexInput input = new BufferedChecksumIndexInput(clone);

            while (true)
            {
                SimpleTextUtil.ReadLine(input, iScratch);
                if (!iScratch.Equals(SimpleTextDocValuesWriter.END))
                {
                    continue;
                }

                SimpleTextUtil.CheckFooter(input);
                break;
            }
        }
Ejemplo n.º 4
0
        private SortedDictionary <string, long?> ReadFields(IndexInput @in)
        {
            ChecksumIndexInput input = new BufferedChecksumIndexInput(@in);
            var scratch = new BytesRef(10);
            var fields  = new SortedDictionary <string, long?>();

            while (true)
            {
                SimpleTextUtil.ReadLine(input, scratch);
                if (scratch.Equals(SimpleTextFieldsWriter.END))
                {
                    SimpleTextUtil.CheckFooter(input);
                    return(fields);
                }

                if (StringHelper.StartsWith(scratch, SimpleTextFieldsWriter.FIELD))
                {
                    var fieldName = Encoding.UTF8.GetString(scratch.Bytes, scratch.Offset + SimpleTextFieldsWriter.FIELD.Length,
                                                            scratch.Length - SimpleTextFieldsWriter.FIELD.Length);
                    fields[fieldName] = input.FilePointer;
                }
            }
        }
 /// <remarks>
 /// we don't actually write a .fdx-like index, instead we read the 
 /// stored fields file in entirety up-front and save the offsets 
 /// so we can seek to the documents later.
 /// </remarks>
 private void ReadIndex(int size)
 {
     ChecksumIndexInput input = new BufferedChecksumIndexInput(_input);
     _offsets = new long[size];
     var upto = 0;
     while (!_scratch.Equals(SimpleTextStoredFieldsWriter.END))
     {
         SimpleTextUtil.ReadLine(input, _scratch);
         if (StringHelper.StartsWith(_scratch, SimpleTextStoredFieldsWriter.DOC))
         {
             _offsets[upto] = input.FilePointer;
             upto++;
         }
     }
     SimpleTextUtil.CheckFooter(input);
     Debug.Assert(upto == _offsets.Length);
 }
Ejemplo n.º 6
0
        private SortedDictionary<string, long?> ReadFields(IndexInput @in)
        {
            ChecksumIndexInput input = new BufferedChecksumIndexInput(@in);
            var scratch = new BytesRef(10);
            var fields = new SortedDictionary<string, long?>();

            while (true)
            {
                SimpleTextUtil.ReadLine(input, scratch);
                if (scratch.Equals(SimpleTextFieldsWriter.END))
                {
                    SimpleTextUtil.CheckFooter(input);
                    return fields;
                }

                if (StringHelper.StartsWith(scratch, SimpleTextFieldsWriter.FIELD))
                {
                    var fieldName = scratch.Bytes.SubList(scratch.Offset + SimpleTextFieldsWriter.FIELD.Length,
                        scratch.Length - SimpleTextFieldsWriter.FIELD.Length).ToString();
                    fields[fieldName] = input.FilePointer;
                }
            }
        }
        public override void CheckIntegrity()
        {
            var iScratch = new BytesRef();
            var clone = (IndexInput) DATA.Clone();
            clone.Seek(0);
            ChecksumIndexInput input = new BufferedChecksumIndexInput(clone);
            while (true)
            {
                SimpleTextUtil.ReadLine(input, iScratch);
                if (!iScratch.Equals(SimpleTextDocValuesWriter.END)) continue;

                SimpleTextUtil.CheckFooter(input);
                break;
            }
        }