@Override public final FieldsProducer fieldsProducer(SegmentReadState state) throws IOException { PostingsReaderBase postings = new Lucene40PostingsReader(state.directory, state.fieldInfos, state.segmentInfo, state.context, state.segmentSuffix); boolean success = false; try { FieldsProducer ret = new Lucene40BlockTreeTermsReader(postings, state); success = true; return ret; } finally { if (!success) { postings.close(); } } }
@Override public void close() throws IOException { try { try { if (indexReader != null) { indexReader.close(); } } finally { // null so if an app hangs on to us (ie, we are not // GCable, despite being closed) we still free most // ram indexReader = null; if (in != null) { in.close(); } } } finally { if (postingsReader != null) { postingsReader.close(); } } }
@Override public FieldsProducer fieldsProducer(final SegmentReadState state) throws IOException { final PostingsReaderBase postings = new Siren10PostingsReader(state.dir, state.segmentInfo, state.context, state.segmentSuffix, this.getFactory()); boolean success = false; try { final FieldsProducer ret = new BlockTreeTermsReader(state.dir, state.fieldInfos, state.segmentInfo, postings, state.context, state.segmentSuffix, state.termsIndexDivisor); success = true; return ret; } finally { if (!success) { postings.close(); } } }
@Override public FieldsProducer fieldsProducer(final SegmentReadState state) throws IOException { final PostingsReaderBase postingsReader = new Siren10PostingsReader(state.directory, state.segmentInfo, state.context, state.segmentSuffix, this.getFactory()); boolean success = false; try { final FieldsProducer ret = new BlockTreeTermsReader(state.directory, state.fieldInfos, state.segmentInfo, postingsReader, state.context, state.segmentSuffix, state.termsIndexDivisor); success = true; return ret; } finally { if (!success) { postingsReader.close(); } } }