Ejemplo n.º 1
0
 /// <param name="oldFormatImpersonationIsActive">
 /// LUCENENET specific
 /// Added to remove dependency on then-static <see cref="LuceneTestCase.OLD_FORMAT_IMPERSONATION_IS_ACTIVE"/> 
 /// </param>
 public Lucene40RWCodec(bool oldFormatImpersonationIsActive)
     : base()
 {
     fieldInfos = new Lucene40FieldInfosFormatAnonymousInnerClassHelper(oldFormatImpersonationIsActive);
     DocValues = new Lucene40RWDocValuesFormat(oldFormatImpersonationIsActive);
     Norms = new Lucene40RWNormsFormat(oldFormatImpersonationIsActive);
 }
Ejemplo n.º 2
0
        /// <param name="oldFormatImpersonationIsActive">
        /// LUCENENET specific
        /// Added to remove dependency on then-static <see cref="LuceneTestCase.OLD_FORMAT_IMPERSONATION_IS_ACTIVE"/>
        /// </param>
        public Lucene41RWCodec(bool oldFormatImpersonationIsActive) : base()
        {
            _oldFormatImpersonationIsActive = oldFormatImpersonationIsActive;

            Norms      = new Lucene40RWNormsFormat(oldFormatImpersonationIsActive);
            fieldInfos = new Lucene40FieldInfosFormatAnonymousInnerClassHelper(oldFormatImpersonationIsActive);
            DocValues  = new Lucene40RWDocValuesFormat(oldFormatImpersonationIsActive);
        }
Ejemplo n.º 3
0
        internal override void Flush(IDictionary <string, InvertedDocEndConsumerPerField> fieldsToFlush, SegmentWriteState state)
        {
            bool success = false;
            DocValuesConsumer normsConsumer = null;

            try
            {
                if (state.FieldInfos.HasNorms)
                {
                    NormsFormat normsFormat = state.SegmentInfo.Codec.NormsFormat;
                    if (Debugging.AssertsEnabled)
                    {
                        Debugging.Assert(normsFormat != null);
                    }
                    normsConsumer = normsFormat.NormsConsumer(state);

                    foreach (FieldInfo fi in state.FieldInfos)
                    {
                        NormsConsumerPerField toWrite = (NormsConsumerPerField)fieldsToFlush[fi.Name];
                        // we must check the final value of omitNorms for the fieldinfo, it could have
                        // changed for this field since the first time we added it.
                        if (!fi.OmitsNorms)
                        {
                            if (toWrite != null && !toWrite.IsEmpty)
                            {
                                toWrite.Flush(state, normsConsumer);
                                if (Debugging.AssertsEnabled)
                                {
                                    Debugging.Assert(fi.NormType == DocValuesType.NUMERIC);
                                }
                            }
                            else if (fi.IsIndexed)
                            {
                                if (Debugging.AssertsEnabled)
                                {
                                    Debugging.Assert(fi.NormType == DocValuesType.NONE, "got {0}; field={1}", fi.NormType, fi.Name);
                                }
                            }
                        }
                    }
                }
                success = true;
            }
            finally
            {
                if (success)
                {
                    IOUtils.Dispose(normsConsumer);
                }
                else
                {
                    IOUtils.DisposeWhileHandlingException(normsConsumer);
                }
            }
        }