public FieldsReader(PerFieldPostingsFormat 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.Indexed) { 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 postings! string suffix = fi.GetAttribute(PER_FIELD_SUFFIX_KEY); Debug.Assert(suffix != null); PostingsFormat format = PostingsFormat.ForName(formatName); string 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 FieldsWriter(PerFieldPostingsFormat outerInstance, SegmentWriteState state) { this.OuterInstance = outerInstance; SegmentWriteState = state; }