private RefCount<DocValuesProducer> newDocValuesProducer(SegmentCommitInfo si, IOContext context, Directory dir, DocValuesFormat dvFormat, final Long gen, FieldInfos infos, int termsIndexDivisor) throws IOException { Directory dvDir = dir; String segmentSuffix = ""; if (gen.longValue() != -1) { dvDir = si.info.dir; // gen'd files are written outside CFS, so use SegInfo directory segmentSuffix = Long.toString(gen.longValue(), Character.MAX_RADIX); } // set SegmentReadState to list only the fields that are relevant to that gen SegmentReadState srs = new SegmentReadState(dvDir, si.info, infos, context, termsIndexDivisor, segmentSuffix); return new RefCount<DocValuesProducer>(dvFormat.fieldsProducer(srs)) { @SuppressWarnings("synthetic-access") @Override protected void release() throws IOException { object.close(); synchronized (SegmentDocValues.this) { genDVProducers.remove(gen); } } }; }
private RefCount<DocValuesProducer> newDocValuesProducer(SegmentCommitInfo si, IOContext context, Directory dir, DocValuesFormat dvFormat, final Long gen, List<FieldInfo> infos, int termsIndexDivisor) throws IOException { Directory dvDir = dir; String segmentSuffix = ""; if (gen.longValue() != -1) { dvDir = si.info.dir; // gen'd files are written outside CFS, so use SegInfo directory segmentSuffix = Long.toString(gen.longValue(), Character.MAX_RADIX); } // set SegmentReadState to list only the fields that are relevant to that gen SegmentReadState srs = new SegmentReadState(dvDir, si.info, new FieldInfos(infos.toArray(new FieldInfo[infos.size()])), context, termsIndexDivisor, segmentSuffix); return new RefCount<DocValuesProducer>(dvFormat.fieldsProducer(srs)) { @SuppressWarnings("synthetic-access") @Override protected void release() throws IOException { object.close(); synchronized (SegmentDocValues.this) { genDVProducers.remove(gen); } } }; }