/** * Loads or returns the already loaded the global field number map for this {@link SegmentInfos}. * If this {@link SegmentInfos} has no global field number map the returned instance is empty */ private FieldNumbers getFieldNumberMap() throws IOException { final FieldNumbers map = new FieldNumbers(); for(SegmentCommitInfo info : segmentInfos) { for(FieldInfo fi : SegmentReader.readFieldInfos(info)) { map.addOrGet(fi.name, fi.number, fi.getDocValuesType()); } } return map; }
void initialize(DocumentsWriter documentsWriter, FieldNumbers globalFieldMap, LiveIndexWriterConfig config) { this.documentsWriter.set(documentsWriter); // thread pool is bound to DW this.globalFieldMap.set(globalFieldMap); for (int i = 0; i < threadStates.length; i++) { final FieldInfos.Builder infos = new FieldInfos.Builder(globalFieldMap); threadStates[i] = new ThreadState(new DocumentsWriterPerThread(documentsWriter.directory, documentsWriter, infos, documentsWriter.chain)); } }
DocumentsWriter(Codec codec, LiveIndexWriterConfig config, Directory directory, IndexWriter writer, FieldNumbers globalFieldNumbers, BufferedDeletesStream bufferedDeletesStream) { this.codec = codec; this.directory = directory; this.indexWriter = writer; this.infoStream = config.getInfoStream(); this.similarity = config.getSimilarity(); this.perThreadPool = config.getIndexerThreadPool(); this.chain = config.getIndexingChain(); this.perThreadPool.initialize(this, globalFieldNumbers, config); flushPolicy = config.getFlushPolicy(); assert flushPolicy != null; flushPolicy.init(this); flushControl = new DocumentsWriterFlushControl(this, config); }
/** * Loads or returns the already loaded the global field number map for this {@link SegmentInfos}. * If this {@link SegmentInfos} has no global field number map the returned instance is empty */ private FieldNumbers getFieldNumberMap() throws IOException { final FieldNumbers map = new FieldNumbers(); for(SegmentInfoPerCommit info : segmentInfos) { for(FieldInfo fi : getFieldInfos(info.info)) { map.addOrGet(fi.name, fi.number, fi.getDocValuesType()); } } return map; }