コード例 #1
0
        public override FieldsConsumer FieldsConsumer(SegmentWriteState state)
        {
            if (!_oldFormatImpersonationIsActive)
            {
                return base.FieldsConsumer(state);
            }
            else
            {
                PostingsWriterBase docs = new Lucene40PostingsWriter(state);

                // TODO: should we make the terms index more easily
                // pluggable?  Ie so that this codec would record which
                // index impl was used, and switch on loading?
                // Or... you must make a new Codec for this?
                bool success = false;
                try
                {
                    FieldsConsumer ret = new BlockTreeTermsWriter(state, docs, MinBlockSize, MaxBlockSize);
                    success = true;
                    return ret;
                }
                finally
                {
                    if (!success)
                    {
                        docs.Dispose();
                    }
                }
            }
        }
コード例 #2
0
        public override FieldsConsumer FieldsConsumer(SegmentWriteState state)
        {
            if (!LuceneTestCase.OLD_FORMAT_IMPERSONATION_IS_ACTIVE)
            {
                return(base.FieldsConsumer(state));
            }
            else
            {
                PostingsWriterBase docs = new Lucene40PostingsWriter(state);

                // TODO: should we make the terms index more easily
                // pluggable?  Ie so that this codec would record which
                // index impl was used, and switch on loading?
                // Or... you must make a new Codec for this?
                bool success = false;
                try
                {
                    FieldsConsumer ret = new BlockTreeTermsWriter(state, docs, MinBlockSize, MaxBlockSize);
                    success = true;
                    return(ret);
                }
                finally
                {
                    if (!success)
                    {
                        docs.Dispose();
                    }
                }
            }
        }
コード例 #3
0
 public override DocValuesConsumer FieldsConsumer(SegmentWriteState state)
 {
     if (!LuceneTestCase.OLD_FORMAT_IMPERSONATION_IS_ACTIVE)
     {
         return base.FieldsConsumer(state);
     }
     else
     {
         string filename = IndexFileNames.SegmentFileName(state.SegmentInfo.Name, "dv", IndexFileNames.COMPOUND_FILE_EXTENSION);
         return new Lucene40DocValuesWriter(state, filename, Lucene40FieldInfosReader.LEGACY_DV_TYPE_KEY);
     }
 }
コード例 #4
0
 public override DocValuesConsumer FieldsConsumer(SegmentWriteState state)
 {
     if (!LuceneTestCase.OLD_FORMAT_IMPERSONATION_IS_ACTIVE)
     {
         return(base.FieldsConsumer(state));
     }
     else
     {
         string filename = IndexFileNames.SegmentFileName(state.SegmentInfo.Name, "dv", IndexFileNames.COMPOUND_FILE_EXTENSION);
         return(new Lucene40DocValuesWriter(state, filename, Lucene40FieldInfosReader.LEGACY_DV_TYPE_KEY));
     }
 }
コード例 #5
0
 public override DocValuesConsumer NormsConsumer(SegmentWriteState state)
 {
     if (!_oldFormatImpersonationIsActive)
     {
         return(base.NormsConsumer(state));
     }
     else
     {
         string filename = IndexFileNames.SegmentFileName(state.SegmentInfo.Name, "nrm", IndexFileNames.COMPOUND_FILE_EXTENSION);
         return(new Lucene40DocValuesWriter(state, filename, Lucene40FieldInfosReader.LEGACY_NORM_TYPE_KEY));
     }
 }
コード例 #6
0
 public override DocValuesConsumer FieldsConsumer(SegmentWriteState state)
 {
     if (!_oldFormatImpersonationIsActive)
     {
         return base.FieldsConsumer(state);
     }
     else
     {
         string filename = IndexFileNames.SegmentFileName(state.SegmentInfo.Name, "dv", IndexFileNames.COMPOUND_FILE_EXTENSION);
         return new Lucene40DocValuesWriter(state, filename, Lucene40FieldInfosReader.LEGACY_DV_TYPE_KEY);
     }
 }
コード例 #7
0
 public override DocValuesConsumer FieldsConsumer(SegmentWriteState state)
 {
     if (!_oldFormatImpersonationIsActive)
     {
         return base.FieldsConsumer(state);
     }
     else
     {
         // note: we choose DEFAULT here (its reasonably fast, and for small bpv has tiny waste)
         return new Lucene42DocValuesConsumer(state, DATA_CODEC, DATA_EXTENSION, METADATA_CODEC, METADATA_EXTENSION, AcceptableOverheadRatio);
     }
 }
コード例 #8
0
 public override DocValuesConsumer FieldsConsumer(SegmentWriteState state)
 {
     if (!LuceneTestCase.OLD_FORMAT_IMPERSONATION_IS_ACTIVE)
     {
         return(base.FieldsConsumer(state));
     }
     else
     {
         // note: we choose DEFAULT here (its reasonably fast, and for small bpv has tiny waste)
         return(new Lucene42DocValuesConsumer(state, DATA_CODEC, DATA_EXTENSION, METADATA_CODEC, METADATA_EXTENSION, m_acceptableOverheadRatio));
     }
 }
コード例 #9
0
 public override DocValuesConsumer FieldsConsumer(SegmentWriteState state)
 {
     if (!_oldFormatImpersonationIsActive)
     {
         return(base.FieldsConsumer(state));
     }
     else
     {
         // note: we choose DEFAULT here (its reasonably fast, and for small bpv has tiny waste)
         return(new Lucene42DocValuesConsumer(state, DATA_CODEC, DATA_EXTENSION, METADATA_CODEC, METADATA_EXTENSION, AcceptableOverheadRatio));
     }
 }
コード例 #10
0
 public override DocValuesConsumer FieldsConsumer(SegmentWriteState state)
 {
     if (!LuceneTestCase.OLD_FORMAT_IMPERSONATION_IS_ACTIVE)
     {
         return base.FieldsConsumer(state);
     }
     else
     {
         // note: we choose DEFAULT here (its reasonably fast, and for small bpv has tiny waste)
         return new Lucene42DocValuesConsumer(state, DATA_CODEC, DATA_EXTENSION, METADATA_CODEC, METADATA_EXTENSION, AcceptableOverheadRatio);
     }
 }
コード例 #11
0
        public PreFlexRWFieldsWriter(SegmentWriteState state)
        {
            TermsOut = new TermInfosWriter(state.Directory, state.SegmentInfo.Name, state.FieldInfos, state.TermIndexInterval);

            bool success = false;
            try
            {
                string freqFile = IndexFileNames.SegmentFileName(state.SegmentInfo.Name, "", Lucene3xPostingsFormat.FREQ_EXTENSION);
                FreqOut = state.Directory.CreateOutput(freqFile, state.Context);
                TotalNumDocs = state.SegmentInfo.DocCount;
                success = true;
            }
            finally
            {
                if (!success)
                {
                    IOUtils.CloseWhileHandlingException(TermsOut);
                }
            }

            success = false;
            try
            {
                if (state.FieldInfos.HasProx())
                {
                    string proxFile = IndexFileNames.SegmentFileName(state.SegmentInfo.Name, "", Lucene3xPostingsFormat.PROX_EXTENSION);
                    ProxOut = state.Directory.CreateOutput(proxFile, state.Context);
                }
                else
                {
                    ProxOut = null;
                }
                success = true;
            }
            finally
            {
                if (!success)
                {
                    IOUtils.CloseWhileHandlingException(TermsOut, FreqOut);
                }
            }

            SkipListWriter = new PreFlexRWSkipListWriter(TermsOut.SkipInterval, TermsOut.MaxSkipLevels, TotalNumDocs, FreqOut, ProxOut);
            //System.out.println("\nw start seg=" + segment);
        }
コード例 #12
0
 internal Lucene42NormsConsumer(SegmentWriteState state, string dataCodec, string dataExtension, string metaCodec, string metaExtension, float acceptableOverheadRatio)
 {
     this.AcceptableOverheadRatio = acceptableOverheadRatio;
     MaxDoc = state.SegmentInfo.DocCount;
     bool success = false;
     try
     {
         string dataName = IndexFileNames.SegmentFileName(state.SegmentInfo.Name, state.SegmentSuffix, dataExtension);
         Data = state.Directory.CreateOutput(dataName, state.Context);
         CodecUtil.WriteHeader(Data, dataCodec, Lucene42DocValuesProducer.VERSION_CURRENT);
         string metaName = IndexFileNames.SegmentFileName(state.SegmentInfo.Name, state.SegmentSuffix, metaExtension);
         Meta = state.Directory.CreateOutput(metaName, state.Context);
         CodecUtil.WriteHeader(Meta, metaCodec, Lucene42DocValuesProducer.VERSION_CURRENT);
         success = true;
     }
     finally
     {
         if (!success)
         {
             IOUtils.CloseWhileHandlingException(this);
         }
     }
 }
コード例 #13
0
 public override DocValuesConsumer NormsConsumer(SegmentWriteState state)
 {
     DocValuesConsumer consumer = @in.NormsConsumer(state);
     Debug.Assert(consumer != null);
     return new AssertingNormsConsumer(consumer, state.SegmentInfo.DocCount);
 }
コード例 #14
0
ファイル: NormsFormat.cs プロジェクト: Cefa68000/lucenenet
 /// <summary>
 /// Returns a <seealso cref="DocValuesConsumer"/> to write norms to the
 ///  index.
 /// </summary>
 public abstract DocValuesConsumer NormsConsumer(SegmentWriteState state);
コード例 #15
0
 public override FieldsConsumer FieldsConsumer(SegmentWriteState state)
 {
     return new AssertingFieldsConsumer(@in.FieldsConsumer(state));
 }
コード例 #16
0
 // private String segment;
 /// <summary>
 /// Creates a <seealso cref="Lucene40PostingsWriter"/>, with the
 ///  <seealso cref="#DEFAULT_SKIP_INTERVAL"/>.
 /// </summary>
 public Lucene40PostingsWriter(SegmentWriteState state)
     : this(state, DEFAULT_SKIP_INTERVAL)
 {
 }
コード例 #17
0
 public override DocValuesConsumer FieldsConsumer(SegmentWriteState state)
 {
     return(new Lucene45DocValuesConsumer(state, DATA_CODEC, DATA_EXTENSION, META_CODEC, META_EXTENSION));
 }
コード例 #18
0
 /// <summary>
 /// Creates the <see cref="Codecs.PostingsWriterBase"/> for this
 /// format.
 /// </summary>
 public abstract PostingsWriterBase PostingsWriterBase(SegmentWriteState state);
コード例 #19
0
 /// <summary>
 /// Creates the <seealso cref="PostingsWriterBase"/> for this
 ///  format.
 /// </summary>
 public abstract PostingsWriterBase PostingsWriterBase(SegmentWriteState state);
コード例 #20
0
 public override FieldsConsumer FieldsConsumer(SegmentWriteState state)
 {
     throw UnsupportedOperationException.Create("this codec can only be used for reading");
 }
コード例 #21
0
 public override DocValuesConsumer NormsConsumer(SegmentWriteState state)
 {
     return(new PreFlexRWNormsConsumer(state.Directory, state.SegmentInfo.Name, state.Context));
 }
コード例 #22
0
 public override FieldsConsumer FieldsConsumer(SegmentWriteState state)
 {
     return new PreFlexRWFieldsWriter(state);
 }
コード例 #23
0
 public override PostingsWriterBase PostingsWriterBase(SegmentWriteState state)
 {
     return new Lucene41PostingsWriter(state);
 }
コード例 #24
0
 public override DocValuesConsumer NormsConsumer(SegmentWriteState state)
 {
     return(new Lucene42NormsConsumer(state, DATA_CODEC, DATA_EXTENSION, METADATA_CODEC, METADATA_EXTENSION, AcceptableOverheadRatio));
 }
コード例 #25
0
 public FieldsWriter(PerFieldDocValuesFormat outerInstance, SegmentWriteState state)
 {
     this.OuterInstance = outerInstance;
     SegmentWriteState = state;
 }
コード例 #26
0
 /// <summary>
 /// Returns a <seealso cref="DocValuesConsumer"/> to write docvalues to the
 ///  index.
 /// </summary>
 public abstract DocValuesConsumer FieldsConsumer(SegmentWriteState state);
コード例 #27
0
 public override sealed DocValuesConsumer FieldsConsumer(SegmentWriteState state)
 {
     return new FieldsWriter(this, state);
 }
コード例 #28
0
 public override PostingsWriterBase PostingsWriterBase(SegmentWriteState state)
 {
     throw new System.NotSupportedException("this codec can only be used for reading");
 }
コード例 #29
0
 public override DocValuesConsumer NormsConsumer(SegmentWriteState state)
 {
     return new Lucene42NormsConsumer(state, DATA_CODEC, DATA_EXTENSION, METADATA_CODEC, METADATA_EXTENSION, AcceptableOverheadRatio);
 }
コード例 #30
0
        /// <summary>
        /// Creates a <seealso cref="Lucene40PostingsWriter"/>, with the
        ///  specified {@code skipInterval}.
        /// </summary>
        public Lucene40PostingsWriter(SegmentWriteState state, int skipInterval)
            : base()
        {
            this.SkipInterval = skipInterval;
            this.SkipMinimum = skipInterval; // set to the same for now
            // this.segment = state.segmentName;
            string fileName = IndexFileNames.SegmentFileName(state.SegmentInfo.Name, state.SegmentSuffix, Lucene40PostingsFormat.FREQ_EXTENSION);
            FreqOut = state.Directory.CreateOutput(fileName, state.Context);
            bool success = false;
            IndexOutput proxOut = null;
            try
            {
                CodecUtil.WriteHeader(FreqOut, Lucene40PostingsReader.FRQ_CODEC, Lucene40PostingsReader.VERSION_CURRENT);
                // TODO: this is a best effort, if one of these fields has no postings
                // then we make an empty prx file, same as if we are wrapped in
                // per-field postingsformat. maybe... we shouldn't
                // bother w/ this opto?  just create empty prx file...?
                if (state.FieldInfos.HasProx())
                {
                    // At least one field does not omit TF, so create the
                    // prox file
                    fileName = IndexFileNames.SegmentFileName(state.SegmentInfo.Name, state.SegmentSuffix, Lucene40PostingsFormat.PROX_EXTENSION);
                    proxOut = state.Directory.CreateOutput(fileName, state.Context);
                    CodecUtil.WriteHeader(proxOut, Lucene40PostingsReader.PRX_CODEC, Lucene40PostingsReader.VERSION_CURRENT);
                }
                else
                {
                    // Every field omits TF so we will write no prox file
                    proxOut = null;
                }
                this.ProxOut = proxOut;
                success = true;
            }
            finally
            {
                if (!success)
                {
                    IOUtils.CloseWhileHandlingException(FreqOut, proxOut);
                }
            }

            TotalNumDocs = state.SegmentInfo.DocCount;

            SkipListWriter = new Lucene40SkipListWriter(skipInterval, MaxSkipLevels, TotalNumDocs, FreqOut, proxOut);
        }
コード例 #31
0
 public override FieldsConsumer FieldsConsumer(SegmentWriteState state)
 {
     throw new NotSupportedException("this codec can only be used for reading");
 }
コード例 #32
0
 public override DocValuesConsumer FieldsConsumer(SegmentWriteState state)
 {
     return new Lucene45DocValuesConsumer(state, DATA_CODEC, DATA_EXTENSION, META_CODEC, META_EXTENSION);
 }
コード例 #33
0
 // note: intentionally ignores seg suffix
 internal Lucene40DocValuesWriter(SegmentWriteState state, string filename, string legacyKey)
 {
     this.State = state;
     this.LegacyKey = legacyKey;
     this.Dir = new CompoundFileDirectory(state.Directory, filename, state.Context, true);
 }
コード例 #34
0
 public override DocValuesConsumer FieldsConsumer(SegmentWriteState state)
 {
     throw new System.NotSupportedException("this codec can only be used for reading");
 }
コード例 #35
0
 public override PostingsWriterBase PostingsWriterBase(SegmentWriteState state)
 {
     return(new Lucene41PostingsWriter(state));
 }
コード例 #36
0
 /// <summary>
 /// expert: Creates a new writer </summary>
 public Lucene45DocValuesConsumer(SegmentWriteState state, string dataCodec, string dataExtension, string metaCodec, string metaExtension)
 {
     bool success = false;
     try
     {
         string dataName = IndexFileNames.SegmentFileName(state.SegmentInfo.Name, state.SegmentSuffix, dataExtension);
         Data = state.Directory.CreateOutput(dataName, state.Context);
         CodecUtil.WriteHeader(Data, dataCodec, Lucene45DocValuesFormat.VERSION_CURRENT);
         string metaName = IndexFileNames.SegmentFileName(state.SegmentInfo.Name, state.SegmentSuffix, metaExtension);
         Meta = state.Directory.CreateOutput(metaName, state.Context);
         CodecUtil.WriteHeader(Meta, metaCodec, Lucene45DocValuesFormat.VERSION_CURRENT);
         MaxDoc = state.SegmentInfo.DocCount;
         success = true;
     }
     finally
     {
         if (!success)
         {
             IOUtils.CloseWhileHandlingException(this);
         }
     }
 }
コード例 #37
0
 public override DocValuesConsumer NormsConsumer(SegmentWriteState state)
 {
     return new PreFlexRWNormsConsumer(state.Directory, state.SegmentInfo.Name, state.Context);
 }