internal Lucene40DocValuesReader(SegmentReadState state, string filename, string legacyKey)
 {
     this.State = state;
     this.LegacyKey = legacyKey;
     this.Dir = new CompoundFileDirectory(state.Directory, filename, state.Context, false);
     RamBytesUsed_Renamed = new AtomicLong(RamUsageEstimator.ShallowSizeOf(this.GetType()));
 }
        public override FieldsProducer FieldsProducer(SegmentReadState state)
        {
            // Whenever IW opens readers, eg for merging, we have to
            // keep terms order in UTF16:

            return new Lucene3xFieldsAnonymousInnerClassHelper(this, state.Directory, state.FieldInfos, state.SegmentInfo, state.Context, state.TermsIndexDivisor);
        }
 public override DocValuesProducer NormsProducer(SegmentReadState state)
 {
     Debug.Assert(state.FieldInfos.HasNorms());
     DocValuesProducer producer = @in.NormsProducer(state);
     Debug.Assert(producer != null);
     return new AssertingDocValuesProducer(producer, state.SegmentInfo.DocCount);
 }
 public override DocValuesProducer FieldsProducer(SegmentReadState state)
 {
     return(new Lucene45DocValuesProducer(state, DATA_CODEC, DATA_EXTENSION, META_CODEC, META_EXTENSION));
 }
Esempio n. 5
0
 /// <summary>
 /// Returns a <seealso cref="DocValuesProducer"/> to read docvalues from the index.
 /// <p>
 /// NOTE: by the time this call returns, it must hold open any files it will
 /// need to use; else, those files may be deleted. Additionally, required files
 /// may be deleted during the execution of this call before there is a chance
 /// to open them. Under these circumstances an IOException should be thrown by
 /// the implementation. IOExceptions are expected and will automatically cause
 /// a retry of the segment opening logic with the newly revised segments.
 /// </summary>
 public abstract DocValuesProducer FieldsProducer(SegmentReadState state);
 /// <summary>
 /// Creates the <see cref="Codecs.PostingsReaderBase"/> for this
 /// format.
 /// </summary>
 public abstract PostingsReaderBase PostingsReaderBase(SegmentReadState state);
Esempio n. 7
0
 /// <summary>
 /// Returns a <see cref="DocValuesProducer"/> to read norms from the index.
 /// <para/>
 /// NOTE: by the time this call returns, it must hold open any files it will
 /// need to use; else, those files may be deleted. Additionally, required files
 /// may be deleted during the execution of this call before there is a chance
 /// to open them. Under these circumstances an <see cref="System.IO.IOException"/> should be thrown by
 /// the implementation. <see cref="System.IO.IOException"/> are expected and will automatically cause
 /// a retry of the segment opening logic with the newly revised segments.
 /// </summary>
 public abstract DocValuesProducer NormsProducer(SegmentReadState state);
Esempio n. 8
0
 /// <summary>
 /// Creates the <seealso cref="PostingsReaderBase"/> for this
 ///  format.
 /// </summary>
 public abstract PostingsReaderBase PostingsReaderBase(SegmentReadState state);
 public override DocValuesProducer FieldsProducer(SegmentReadState state)
 {
     string filename = IndexFileNames.SegmentFileName(state.SegmentInfo.Name, "dv", IndexFileNames.COMPOUND_FILE_EXTENSION);
     return new Lucene40DocValuesReader(state, filename, Lucene40FieldInfosReader.LEGACY_DV_TYPE_KEY);
 }
 public override PostingsReaderBase PostingsReaderBase(SegmentReadState state)
 {
     return(new Lucene41PostingsReader(state.Directory, state.FieldInfos, state.SegmentInfo, state.Context, state.SegmentSuffix));
 }
Esempio n. 11
0
 public override DocValuesProducer NormsProducer(SegmentReadState state)
 {
     return new Lucene3xNormsProducer(state.Directory, state.SegmentInfo, state.FieldInfos, state.Context);
 }
 public override PostingsReaderBase PostingsReaderBase(SegmentReadState state)
 {
     return new Lucene40PostingsReader(state.Directory, state.FieldInfos, state.SegmentInfo, state.Context, state.SegmentSuffix);
 }
            public FieldsReader(PerFieldDocValuesFormat outerInstance, SegmentReadState readState)
            {
                this.OuterInstance = outerInstance;

                // Read _X.per and init each format:
                bool success = false;
                try
                {
                    // Read field name -> format name
                    foreach (FieldInfo fi in readState.FieldInfos)
                    {
                        if (fi.HasDocValues())
                        {
                            string fieldName = fi.Name;
                            string formatName = fi.GetAttribute(PER_FIELD_FORMAT_KEY);
                            if (formatName != null)
                            {
                                // null formatName means the field is in fieldInfos, but has no docvalues!
                                string suffix = fi.GetAttribute(PER_FIELD_SUFFIX_KEY);
                                Debug.Assert(suffix != null);
                                DocValuesFormat format = DocValuesFormat.ForName(formatName);
                                string segmentSuffix = GetFullSegmentSuffix(readState.SegmentSuffix, GetSuffix(formatName, suffix));
                                if (!Formats.ContainsKey(segmentSuffix))
                                {
                                    Formats[segmentSuffix] = format.FieldsProducer(new SegmentReadState(readState, segmentSuffix));
                                }
                                Fields[fieldName] = Formats[segmentSuffix];
                            }
                        }
                    }
                    success = true;
                }
                finally
                {
                    if (!success)
                    {
                        IOUtils.CloseWhileHandlingException(Formats.Values);
                    }
                }
            }
 public override sealed DocValuesProducer FieldsProducer(SegmentReadState state)
 {
     return new FieldsReader(this, state);
 }
 public override FieldsProducer FieldsProducer(SegmentReadState state)
 {
     return new AssertingFieldsProducer(@in.FieldsProducer(state));
 }
Esempio n. 16
0
 public override DocValuesProducer NormsProducer(SegmentReadState state)
 {
     return new Lucene42DocValuesProducer(state, DATA_CODEC, DATA_EXTENSION, METADATA_CODEC, METADATA_EXTENSION);
 }
Esempio n. 17
0
 /// <summary>
 /// Returns a <seealso cref="DocValuesProducer"/> to read norms from the index.
 /// <p>
 /// NOTE: by the time this call returns, it must hold open any files it will
 /// need to use; else, those files may be deleted. Additionally, required files
 /// may be deleted during the execution of this call before there is a chance
 /// to open them. Under these circumstances an IOException should be thrown by
 /// the implementation. IOExceptions are expected and will automatically cause
 /// a retry of the segment opening logic with the newly revised segments.
 /// </summary>
 public abstract DocValuesProducer NormsProducer(SegmentReadState state);
Esempio n. 18
0
 public override FieldsProducer FieldsProducer(SegmentReadState state)
 {
     return(new Lucene3xFields(state.Directory, state.FieldInfos, state.SegmentInfo, state.Context, state.TermsIndexDivisor));
 }
        /// <summary>
        /// expert: instantiates a new reader </summary>
        protected internal Lucene45DocValuesProducer(SegmentReadState state, string dataCodec, string dataExtension, string metaCodec, string metaExtension)
        {
            string metaName = IndexFileNames.SegmentFileName(state.SegmentInfo.Name, state.SegmentSuffix, metaExtension);
            // read in the entries from the metadata file.
            ChecksumIndexInput @in = state.Directory.OpenChecksumInput(metaName, state.Context);
            this.MaxDoc = state.SegmentInfo.DocCount;
            bool success = false;
            try
            {
                Version = CodecUtil.CheckHeader(@in, metaCodec, Lucene45DocValuesFormat.VERSION_START, Lucene45DocValuesFormat.VERSION_CURRENT);
                Numerics = new Dictionary<int, NumericEntry>();
                Ords = new Dictionary<int, NumericEntry>();
                OrdIndexes = new Dictionary<int, NumericEntry>();
                Binaries = new Dictionary<int, BinaryEntry>();
                SortedSets = new Dictionary<int, SortedSetEntry>();
                ReadFields(@in, state.FieldInfos);

                if (Version >= Lucene45DocValuesFormat.VERSION_CHECKSUM)
                {
                    CodecUtil.CheckFooter(@in);
                }
                else
                {
                    CodecUtil.CheckEOF(@in);
                }

                success = true;
            }
            finally
            {
                if (success)
                {
                    IOUtils.Close(@in);
                }
                else
                {
                    IOUtils.CloseWhileHandlingException(@in);
                }
            }

            success = false;
            try
            {
                string dataName = IndexFileNames.SegmentFileName(state.SegmentInfo.Name, state.SegmentSuffix, dataExtension);
                Data = state.Directory.OpenInput(dataName, state.Context);
                int version2 = CodecUtil.CheckHeader(Data, dataCodec, Lucene45DocValuesFormat.VERSION_START, Lucene45DocValuesFormat.VERSION_CURRENT);
                if (Version != version2)
                {
                    throw new Exception("Format versions mismatch");
                }

                success = true;
            }
            finally
            {
                if (!success)
                {
                    IOUtils.CloseWhileHandlingException(this.Data);
                }
            }

            RamBytesUsed_Renamed = new AtomicLong(RamUsageEstimator.ShallowSizeOfInstance(this.GetType()));
        }