//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: @Override public codecs.FieldsProducer fieldsProducer(index.SegmentReadState state) throws java.io.IOException public override FieldsProducer fieldsProducer(SegmentReadState state) { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final String fileName = index.IndexFileNames.segmentFileName(state.segmentInfo.name, state.segmentSuffix, EXTENSION); string fileName = IndexFileNames.segmentFileName(state.segmentInfo.name, state.segmentSuffix, EXTENSION); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final store.ChecksumIndexInput in = state.directory.openChecksumInput(fileName, store.IOContext.READONCE); ChecksumIndexInput @in = state.directory.openChecksumInput(fileName, IOContext.READONCE); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final java.util.SortedMap<String,TermsReader> fields = new java.util.TreeMap<>(); SortedMap <string, TermsReader> fields = new SortedDictionary <string, TermsReader>(); try { CodecUtil.checkHeader(@in, CODEC_NAME, VERSION_START, VERSION_CURRENT); while (true) { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final int termCount = in.readVInt(); int termCount = @in.readVInt(); if (termCount == 0) { break; } //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final TermsReader termsReader = new TermsReader(state.fieldInfos, in, termCount); TermsReader termsReader = new TermsReader(state.fieldInfos, @in, termCount); // System.out.println("load field=" + termsReader.field.name); fields.put(termsReader.field.name, termsReader); } CodecUtil.checkFooter(@in); } finally { @in.close(); } return(new FieldsProducerAnonymousInnerClassHelper(this, fields)); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: @Override public index.FieldInfos read(store.Directory directory, String segmentName, String segmentSuffix, store.IOContext iocontext) throws java.io.IOException public override FieldInfos read(Directory directory, string segmentName, string segmentSuffix, IOContext iocontext) { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final String fileName = index.IndexFileNames.segmentFileName(segmentName, segmentSuffix, FIELD_INFOS_EXTENSION); string fileName = IndexFileNames.segmentFileName(segmentName, segmentSuffix, FIELD_INFOS_EXTENSION); ChecksumIndexInput input = directory.openChecksumInput(fileName, iocontext); BytesRef scratch = new BytesRef(); bool success = false; try { SimpleTextUtil.ReadLine(input, scratch); Debug.Assert(StringHelper.StartsWith(scratch, NUMFIELDS)); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final int size = Integer.parseInt(readString(NUMFIELDS.length, scratch)); int size = Convert.ToInt32(readString(NUMFIELDS.length, scratch)); FieldInfo[] infos = new FieldInfo[size]; for (int i = 0; i < size; i++) { SimpleTextUtil.ReadLine(input, scratch); Debug.Assert(StringHelper.StartsWith(scratch, NAME)); string name = readString(NAME.length, scratch); SimpleTextUtil.ReadLine(input, scratch); Debug.Assert(StringHelper.StartsWith(scratch, NUMBER)); int fieldNumber = Convert.ToInt32(readString(NUMBER.length, scratch)); SimpleTextUtil.ReadLine(input, scratch); Debug.Assert(StringHelper.StartsWith(scratch, ISINDEXED)); bool isIndexed = Convert.ToBoolean(readString(ISINDEXED.length, scratch)); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final index.FieldInfo.IndexOptions indexOptions; FieldInfo.IndexOptions indexOptions; if (isIndexed) { SimpleTextUtil.ReadLine(input, scratch); Debug.Assert(StringHelper.StartsWith(scratch, INDEXOPTIONS)); indexOptions = FieldInfo.IndexOptions.valueOf(readString(INDEXOPTIONS.length, scratch)); } else { indexOptions = null; } SimpleTextUtil.ReadLine(input, scratch); Debug.Assert(StringHelper.StartsWith(scratch, STORETV)); bool storeTermVector = Convert.ToBoolean(readString(STORETV.length, scratch)); SimpleTextUtil.ReadLine(input, scratch); Debug.Assert(StringHelper.StartsWith(scratch, PAYLOADS)); bool storePayloads = Convert.ToBoolean(readString(PAYLOADS.length, scratch)); SimpleTextUtil.ReadLine(input, scratch); Debug.Assert(StringHelper.StartsWith(scratch, NORMS)); bool omitNorms = !Convert.ToBoolean(readString(NORMS.length, scratch)); SimpleTextUtil.ReadLine(input, scratch); Debug.Assert(StringHelper.StartsWith(scratch, NORMS_TYPE)); string nrmType = readString(NORMS_TYPE.length, scratch); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final index.FieldInfo.DocValuesType normsType = docValuesType(nrmType); FieldInfo.DocValuesType normsType = docValuesType(nrmType); SimpleTextUtil.ReadLine(input, scratch); Debug.Assert(StringHelper.StartsWith(scratch, DOCVALUES)); string dvType = readString(DOCVALUES.length, scratch); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final index.FieldInfo.DocValuesType docValuesType = docValuesType(dvType); FieldInfo.DocValuesType docValuesType = docValuesType(dvType); SimpleTextUtil.ReadLine(input, scratch); Debug.Assert(StringHelper.StartsWith(scratch, DOCVALUES_GEN)); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final long dvGen = Long.parseLong(readString(DOCVALUES_GEN.length, scratch)); long dvGen = Convert.ToInt64(readString(DOCVALUES_GEN.length, scratch)); SimpleTextUtil.ReadLine(input, scratch); Debug.Assert(StringHelper.StartsWith(scratch, NUM_ATTS)); int numAtts = Convert.ToInt32(readString(NUM_ATTS.length, scratch)); IDictionary <string, string> atts = new Dictionary <string, string>(); for (int j = 0; j < numAtts; j++) { SimpleTextUtil.ReadLine(input, scratch); Debug.Assert(StringHelper.StartsWith(scratch, ATT_KEY)); string key = readString(ATT_KEY.length, scratch); SimpleTextUtil.ReadLine(input, scratch); Debug.Assert(StringHelper.StartsWith(scratch, ATT_VALUE)); string value = readString(ATT_VALUE.length, scratch); atts[key] = value; } infos[i] = new FieldInfo(name, isIndexed, fieldNumber, storeTermVector, omitNorms, storePayloads, indexOptions, docValuesType, normsType, Collections.unmodifiableMap(atts)); infos[i].DocValuesGen = dvGen; } SimpleTextUtil.CheckFooter(input); FieldInfos fieldInfos = new FieldInfos(infos); success = true; return(fieldInfos); } finally { if (success) { input.close(); } else { IOUtils.closeWhileHandlingException(input); } } }