예제 #1
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();
                    }
                }
            }
        }
        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();
                    }
                }
            }
        }